#gui visibility

1 messages · Page 1 of 1 (latest)

rancid bison
#

i made a script so that when im holding q a text label will be visible, and when i let go of q, it wont be visible. when i test what i made, i receive no errors, and it shows that it's visible in the properties, but it doesnt appear on my screen, any ideas?

surreal meteor
#

Hello, im new to scripting but i think it is because you need to change to local players gui instead of startergui

local HoldingQGui= 
player.PlayerGui.ScreenGui.TextLabel ```
cloud kernel
#

That code is a really bad way of doing what your trying to do. It creates a memory leak and is overall way too complicated

Your better off doing something like this:
-# It contains a bit of repeated code and could be simplified down but this is just an example

uis.InputBegan:Connect(function, input, typing)
  if typing then return end
  if input.KeyCode == HoldingQ then
    HoldingQGui.Visible = true
  end
end)

uis.InputEnded:Connect(function, input, typing)
  if input.KeyCode == HoldingQ then
    HoldingQGui.Visible = false
  end
end)

Or even this (its the same as what your doing but not broken. You should use events instead of this though)

while task.wait() do
  HoldingGui.Visible = uis:IsKeyDown(HoldingQ)
end