Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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!

3 comments

0

Thanks that really helped! But i still dont get why i should edit PlayerGui and not StarterGui...

0

Oh and when should i use PlayerGui and when StarterGui???

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..

This discussion is preserved as it was. New answers, comments, and votes are closed.