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

How to make a keybinding Gui?

Asked by 9 years ago

Look i am making this game all on my own because nobody will help so please give me this little bit of support.

How would i make a Keybinding Gui script? So like Press H for help

2 answers

Log in to vote
1
Answered by 9 years ago

Okay, assuming that it is a frame that you want to be opened, you would do this. Just make a Local Script inside the frame and paste this in it.

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

mouse.KeyDown:connect(function(key)
        if key == "h" then
    if script.Parent.Visible == true then
        script.Parent.Visible = false
    else
        script.Parent.Visible = true
    end
        end
end)
0
Thank you have saved me alot of time Codboy22 9 — 9y
0
Np attackonkyojin 135 — 9y
0
IF you need a script to run an animation on click or on a keydown just make another question and PM me on roblox. attackonkyojin 135 — 9y
Ad
Log in to vote
0
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
9 years ago

Well, to detect when a player pushes a button, you would use KeyDown as well as GetMouse to get the Player's mouse.. Example:

mouse = game.Players.LocalPlayer:GetMouse()

local function onKeyDown( key )
    if key:lower() == "h" then
    -- Your Code
end
mouse.KeyDown:connect(onKeyDown)
0
Yours is also good for tools as well if i could i would accept both Codboy22 9 — 9y

Answer this question