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

Can I create custom Roblox Keybinds?

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

✓ Accepted answer

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.

3 comments

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]

0

what if it was letters e.g I

0

i checked the keybinds

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

2 comments

0

Thanks! :)

0

No problem.

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