RB-004
Roblox double jump script
Press jump again in mid-air for a second jump.
- Script type
- LocalScript
- Where it goes
- StarterPlayer > StarterPlayerScripts
- Category
- Movement
For your own game in Roblox Studio. Not for use in other people's games.
The code
-- Double jump: press Jump again while in the air.
local MAX_JUMPS = 2 -- 2 = one extra jump in the air. 3 = triple jump.
local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local player = Players.LocalPlayer
local humanoid = nil
local airJumpsUsed = 0
local function onCharacterAdded(character)
humanoid = character:WaitForChild("Humanoid")
airJumpsUsed = 0
humanoid.StateChanged:Connect(function(_, newState)
-- Touching the ground gives the extra jumps back.
if newState == Enum.HumanoidStateType.Landed
or newState == Enum.HumanoidStateType.Running then
airJumpsUsed = 0
end
end)
end
player.CharacterAdded:Connect(onCharacterAdded)
if player.Character then
onCharacterAdded(player.Character)
end
UserInputService.JumpRequest:Connect(function()
if not humanoid or humanoid.Health <= 0 then
return
end
local state = humanoid:GetState()
if state == Enum.HumanoidStateType.Freefall and airJumpsUsed < MAX_JUMPS - 1 then
airJumpsUsed += 1
humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
end
end)How to set it up
- Open StarterPlayer, then StarterPlayerScripts, in the Explorer.
- Add a LocalScript there.
- Paste the code.
- Play, jump, and press Space again in the air.
Change it
- Set MAX_JUMPS to 3 for a triple jump.
- The script gives the jumps back when you land. Walking off a ledge counts as being in the air, so you can still use the extra jump.
- Because this runs on the player's device, it is fine for fun. It is not cheat proof.
More in Movement
More Roblox tools
- Shirt and pants templatesFree Roblox clothing templates to download: hoodies, jerseys, jeans, joggers and more.
- Robux tax calculatorWork out what you receive after the marketplace fee, or what to charge.
- Robux to USD calculatorConvert earned Robux to dollars at a DevEx rate you can edit.
- Shirt and pants template makerColour each panel of the 585×559 clothing template and download it.
- Username generatorGenerate usernames that fit the 3–20 character rule.