Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My Keypress doesnt make gui.Visible = true, help!?

Asked by
Jurdy 0
10 years ago
player = game.Players.LocalPlayer
mouse = game.Players.LocalPlayer:GetMouse()

  mouse.KeyDown:connect(function(key)
   if key == "h" then
    game.StarterGui.ATMhacker.Frame.ihack.Visible = true

 else
print("Y U No Press H")
end
end)

-- it works when i use Print(), but not this, please help me out!

1 answer

Log in to vote
0
Answered by 10 years ago

If you edit the StarterGui, you're editing what people will see after joining or resetting. Edit player's PlayerGui.

player = game.Players.LocalPlayer
mouse = game.Players.LocalPlayer:GetMouse()

  mouse.KeyDown:connect(function(key)
   if key == "h" then
    player.PlayerGui.ATMhacker.Frame.ihack.Visible = true

 else
print("Y U No Press H")
end
end)

-- it works when i use Print(), but not this, please help me out!

0
Thanks that really helped! But i still dont get why i should edit PlayerGui and not StarterGui... Jurdy 0 — 10y
0
Oh and when should i use PlayerGui and when StarterGui??? Jurdy 0 — 10y
0
You should always use PlayerGui because that is what the player sees. If you edit StarterGui that's what people will see on respawn.. figgycity50 70 — 10y
Ad

Answer this question