I have a GUI and I want to press a key, for example 'X' and the gui will open Press X again and it will close
COMMUNITY QUESTION
Someone help with Keypress Script??
1 answer
This isn't a request site, but since this script is fairly easy... You need to use the KeyDown event as well as debounce.
Local Script
mouse = game.Players.LocalPlayer:GetMouse()
open = false
mouse.KeyDown:connect(function(key)
if key:lower() == "x" then
if open == false then
script.Parent.Frame.Visible = true
open = true
else
script.Parent.Frame.Visible = false
open = false
end
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Include a script.