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

Open GUI on Key?

I'm looking to create a shortcut to opening my game's Menu GUI. The shortcut will be the press of the key, "X" or something like that...

I would greatly appreciate it if someone would help me out with this...

Please provide specific details/sources. (It helps me learn faster)

Thanks for the help!

1 answer

✓ Accepted answer

Use the KeyDown event.

--LocalScript
repeat wait() until game.Players.LocalPlayer
local p = game.Players.LocalPlayer
local m = p:GetMouse()
local folder = p.PlayerGui:WaitForChild("GUINAME")
local guitoopen = folder["Directoryhere"]

m.KeyDown:connect(function(key)
	if key:lower() == "x" then 
		if guitoopen.Visible then 
			guitoopen.Visible = false
		else
			guitoopen.Visible = true
		end
	end
end)

1 comment

1

Thanks!

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