Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I need help with a hotkey script?

Asked by
Asirix 15
10 years ago

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

Log in to vote
0
Answered by 10 years ago

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)

Ad

Answer this question