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

Can I create custom Roblox Keybinds?

Asked by 10 years ago

I am curious if its possible to create a custom Roblox keybind, such as pressing 'C' for crouch? If so, do I need to use a Local Script, Script, or a certain function or something?

2 answers

Log in to vote
3
Answered by 10 years ago

This is a LocalScript I put in the StarterPack.

Sprint_Speed = 30 --[[The default walkspeed is 16 so]]--
                  --[[the Sprint_Speed number should]]--
                  --[[be higher than 16             ]]--

MyMouse = game.Players.localPlayer:GetMouse()
Player = game.Players.localPlayer

MyMouse.KeyDown:connect(function(key)
    if (key:byte() == 48) then
    local human = Player.Character:FindFirstChild("Humanoid")
    human.WalkSpeed = Sprint_Speed
    end
end)

MyMouse.KeyUp:connect(function(key)
    if (key:byte() == 48) then
    local human = Player.Character:FindFirstChild("Humanoid")
    human.WalkSpeed = 16
    end
end)

The following below is a list of all of the other key:byte() == (Number here)'s. Backspace 8, Tab 9, Enter 13,
Up Key 17,
Down Key 18,
Right Key 19, Left Key 20,
Home 22,
End 23,
F2 27,
F4 29,
F5 30,
F7 32, F8 33, F9 34, F10 35, F12 37, Right Shift 47, Left Shift 48, Right Ctrl 49, Left Ctrl 50, Right Alt 51, Left Alt 52.

0
Great post, I was the one who one-upped it but none the less wouldn't it make more sense to define the player and the do player:GetMouse() [Btw I have made these sorts of scripts before] VariadicFunction 335 — 10y
0
what if it was letters e.g I EnzoTDZ_YT 275 — 5y
0
i checked the keybinds TNTIsLyfe 152 — 4y
Ad
Log in to vote
-1
Answered by 10 years ago

Yes you can make key binds. Not Sure what type of script. I believe Local.

0
Thanks! :) AwsomeSpongebob 350 — 10y
0
No problem. Roboy5857 20 — 10y

Answer this question