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

I need help with a hotkey script?

Basically, you press a button, and it toggles a gui's visibility.

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

mouse.KeyDown:connect(function(key)
	if key == "115"  then 
		script.Parent.Visible = not script.Parent.Visible
	end
end)

1 answer

You either do this:

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

mouse.KeyDown:connect(function(key)
    if key:byte() == 115  then 
        script.Parent.Visible = not script.Parent.Visible
    end
end)

Or this:

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

mouse.KeyDown:connect(function(key)
    if key == "s"  then 
        script.Parent.Visible = not script.Parent.Visible
    end
end)

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