Hello, I have done due diligence, googled, and searched the Developer Hub to no avail. I cannot figure out how to bind a new key to Jumping. I am NOT requesting you to script it for me. I am asking for an explanation of what I'd need to do to make the script myself.
How do I make a custom jump key (and unbind the original one)???
2 answers
Hello there.
You must use ContextActionService. It is used for binding actions to keys.
You can first unbind the jump action by using ContextActionService:UnbindAction("jumpAction").
Then, you can use UserInputService to detect the input when the player jumped.
Example Code:
local UserInputService = game:GetService("UserInputService")
local ContextActionService = game:GetService("ContextActionService")
ContextActionService:UnbindAction("jumpAction")
UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
if input.KeyCode == Enum.KeyCode.LeftControl and gameProcessedEvent then
local character = game:GetService("Players").LocalPlayer.Character
if character then
if character.Humanoid.Health > 0 then
character.Humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
end
end
end
end)
How it Works
You must first unbind the "jumpAction" action. Then, you must use the InputBegan event of UserInputService to detect when the client makes an action. Next, you must check if the KeyCode is the KeyCode you want and that the player isn't in chat. I used LeftControl as the jump key. Then, you must check if the character isn't nil and if the character's health is above 0. If it is, the humanoid will then jump.
Please accept this answer if it helped.
What I think that will work is use a body force or something like that and make it move the player upwards, then just set the jump power to 0. It is probably not the best way but it should work.
2 comments
This isn't really the answer I'm looking for, because I might apply the same principle to other things, such as walking, and I don't really want a hacky solution. This would probably work,though. There has to be a clean way to do it with the already-present jump function, right?
yea probs but im not that good with scripting so thats how i thought it would work lmao
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
How did you know the Jump Action was called jumpAction? Are there documentation of the default ROBLOX actions?
Also, do you unbind on the client or server?
Unbind it on the client. There's a BindedActions dropdown on the developer console and it tells you the name of all actions.