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

Someone help with Keypress Script??

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

1 comment

2

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