Tutorial · Gameplay

How to make a double jump in Roblox Studio

A double jump lets a player press jump a second time while they are in the air and go up again. Roblox has no setting for it, but the Humanoid already knows when the character is jumping, falling and landing. A short LocalScript listens to those states, counts how many air jumps are left, and starts a new jump with Humanoid:ChangeState. This guide builds that script, then adds a server Script that decides how many air jumps each player gets, so a game pass or a power-up can turn it into a triple jump.

Updated 14 November 20269 min readBeginnerLuauWritten by

In short

Put a LocalScript in StarterCharacterScripts. Listen to UserInputService.JumpRequest, and when the Humanoid's state is Freefall and the player has an air jump left, call humanoid:ChangeState(Enum.HumanoidStateType.Jumping). Refill the air jumps in Humanoid.StateChanged when the state becomes Landed, and ignore repeat requests from one held press.

  • ChangeState must run on the device that owns the character, which is the player's own device. A server Script cannot make a player jump.
  • JumpRequest fires several times for one press, so the script needs a short gap between jumps or one press spends every air jump.
  • The server decides how many air jumps a player gets by setting a player attribute. The LocalScript reads it, so a triple jump is a one-number change.

Get the script

Double jump script for PC, phone and gamepad

One LocalScript in StarterCharacterScripts: press jump in the air to jump again, air jumps refill on landing, and the server can raise the count.

LocalScript in StarterCharacterScripts named DoubleJump
-- LocalScript in StarterCharacterScripts named DoubleJump.
-- Press jump in the air to jump again. Air jumps refill when you land.
-- Roblox copies this script into every new character, so each life starts fresh.
local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")

local DEFAULT_AIR_JUMPS = 1 -- used until the server sets the AirJumps attribute
local MIN_SECONDS_BETWEEN_JUMPS = 0.25 -- JumpRequest fires several times for one press
local NEW_PRESS_GAP = 0.1 -- a held button keeps requesting jumps; a pause this long means a new press

local player = Players.LocalPlayer
local character = script.Parent :: Model
local humanoid = character:WaitForChild("Humanoid") :: Humanoid

local jumpsLeft = 0
local lastJump = 0
local lastRequest = 0

-- The server can change the number of air jumps with a player attribute (Step 3)
local function getAirJumps(): number
	local value = player:GetAttribute("AirJumps")
	if typeof(value) == "number" then
		return math.clamp(math.floor(value), 0, 10)
	end
	return DEFAULT_AIR_JUMPS
end

-- States where the character is not in the air: air jumps are taken away
local GROUNDED: { [Enum.HumanoidStateType]: boolean } = {
	[Enum.HumanoidStateType.Landed] = true,
	[Enum.HumanoidStateType.Running] = true,
	[Enum.HumanoidStateType.Swimming] = true,
	[Enum.HumanoidStateType.Climbing] = true,
	[Enum.HumanoidStateType.Seated] = true,
	[Enum.HumanoidStateType.Dead] = true,
}

humanoid.StateChanged:Connect(function(oldState: Enum.HumanoidStateType, newState: Enum.HumanoidStateType)
	if newState == Enum.HumanoidStateType.Jumping and oldState ~= Enum.HumanoidStateType.Freefall then
		-- A jump from the ground (not one of our air jumps) hands out the air jumps
		jumpsLeft = getAirJumps()
		lastJump = os.clock()
	elseif newState == Enum.HumanoidStateType.Freefall and oldState ~= Enum.HumanoidStateType.Jumping then
		-- Walked off a ledge without jumping: allow the air jumps here too.
		-- Delete these two lines if a fall should not give a jump.
		jumpsLeft = getAirJumps()
	elseif GROUNDED[newState] then
		jumpsLeft = 0
	end
end)

local function airJump()
	jumpsLeft -= 1
	lastJump = os.clock()
	-- Roblox pushes the character up with its normal jump strength and plays the jump animation
	humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
end

-- JumpRequest fires for Space, the phone jump button and the gamepad A button
UserInputService.JumpRequest:Connect(function()
	local now = os.clock()
	local newPress = now - lastRequest > NEW_PRESS_GAP
	lastRequest = now
	if not newPress or jumpsLeft <= 0 or now - lastJump < MIN_SECONDS_BETWEEN_JUMPS then
		return
	end
	if humanoid.Health <= 0 or humanoid.FloorMaterial ~= Enum.Material.Air then
		return -- dead, or still on the ground: Roblox handles a normal jump itself
	end
	if humanoid:GetState() == Enum.HumanoidStateType.Freefall then
		airJump()
	end
end)

RoCode builds it in the place you have open in Roblox Studio, on Windows or macOS with a desktop browser; on a phone the button sends the prompt and the link to your computer. Free to start, with free credits every day. More Roblox Studio scripts

Where to put it

Explorer: the LocalScript does the jumping, the Script sets the count
StarterPlayer
  StarterCharacterScripts
    DoubleJump LocalScript new
ServerScriptService
  JumpSettings Script (new, Step 3)

Settings you can change

DEFAULT_AIR_JUMPSIn the script
Air jumps when the server has not set the AirJumps attribute. 1 is a double jump, 2 a triple jump. Default: 1.
MIN_SECONDS_BETWEEN_JUMPSIn the script
Shortest time between two jumps, so one press cannot fire several air jumps. Default: 0.25.
NEW_PRESS_GAPIn the script
Seconds with no jump requests before a request counts as a new press, so holding the button does not spend the air jump. Default: 0.1.

The LocalScript must go in StarterCharacterScripts, not StarterPlayerScripts: its first line uses script.Parent as the character.

What a cheater can and cannot doEach player's device moves its own character, so a cheater can jump as often as they like whatever this script says. The server only chooses the AirJumps number for honest players. Do not hide anything valuable behind a double jump alone: Step 3 explains what the server can and cannot check.

Type-checked with luau-lsp strict against Roblox's API definitions on 14 November 2026. Not playtested in Studio yet: press Play and watch the Output window before you publish.

Prompt for RoCode

Add a double jump to my game: a LocalScript in StarterCharacterScripts that uses UserInputService.JumpRequest and Humanoid.StateChanged to allow one extra jump in the air with ChangeState Jumping, refills it on landing, ignores a held jump button with a 0.25 second gap, and reads the number of air jumps from a player attribute AirJumps that a Script in ServerScriptService sets to 1 for everyone.

On this page
  1. Get the script
  2. How it works
  3. 1. LocalScript
  4. 2. Explained
  5. 3. Server count
  6. 4. Test
  7. Common errors
  8. With RoCode
  9. Questions
  10. Sources

How a double jump works in Roblox

Every character has a Humanoid that moves between states: Running on the ground, Jumping for the moment the character pushes off, Freefall while it is in the air, and Landed when it touches down again. Humanoid.StateChanged fires on every change and passes the old state and the new one.

A normal jump only works from the ground. To jump in the air, the script asks the Humanoid to enter Jumping again while it is in Freefall. Roblox then pushes the character up with its normal jump strength, and the Animate script plays the jump animation as if the player had jumped from the floor.

The states a double jump cares about
StateWhen it happensWhat the script does
Jumping (from the ground)The player jumps from the floor.Gives the air jumps for this jump.
FreefallThe character is in the air, going up or down.An air jump is allowed now.
LandedThe character touches the ground.Takes the unused air jumps away.
Swimming, Climbing, SeatedIn water, on a ladder, in a seat.No air jumps.

Step 1: The double jump LocalScript

  1. In the Explorer, expand StarterPlayer, hover over StarterCharacterScripts, click + and insert a LocalScript. Name it DoubleJump.
  2. Replace its contents with the code below.
  3. Press Play, jump, and press jump again while you are in the air.
LocalScript in StarterCharacterScripts named DoubleJump
-- LocalScript in StarterCharacterScripts named DoubleJump.
-- Press jump in the air to jump again. Air jumps refill when you land.
-- Roblox copies this script into every new character, so each life starts fresh.
local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")

local DEFAULT_AIR_JUMPS = 1 -- used until the server sets the AirJumps attribute
local MIN_SECONDS_BETWEEN_JUMPS = 0.25 -- JumpRequest fires several times for one press
local NEW_PRESS_GAP = 0.1 -- a held button keeps requesting jumps; a pause this long means a new press

local player = Players.LocalPlayer
local character = script.Parent :: Model
local humanoid = character:WaitForChild("Humanoid") :: Humanoid

local jumpsLeft = 0
local lastJump = 0
local lastRequest = 0

-- The server can change the number of air jumps with a player attribute (Step 3)
local function getAirJumps(): number
	local value = player:GetAttribute("AirJumps")
	if typeof(value) == "number" then
		return math.clamp(math.floor(value), 0, 10)
	end
	return DEFAULT_AIR_JUMPS
end

-- States where the character is not in the air: air jumps are taken away
local GROUNDED: { [Enum.HumanoidStateType]: boolean } = {
	[Enum.HumanoidStateType.Landed] = true,
	[Enum.HumanoidStateType.Running] = true,
	[Enum.HumanoidStateType.Swimming] = true,
	[Enum.HumanoidStateType.Climbing] = true,
	[Enum.HumanoidStateType.Seated] = true,
	[Enum.HumanoidStateType.Dead] = true,
}

humanoid.StateChanged:Connect(function(oldState: Enum.HumanoidStateType, newState: Enum.HumanoidStateType)
	if newState == Enum.HumanoidStateType.Jumping and oldState ~= Enum.HumanoidStateType.Freefall then
		-- A jump from the ground (not one of our air jumps) hands out the air jumps
		jumpsLeft = getAirJumps()
		lastJump = os.clock()
	elseif newState == Enum.HumanoidStateType.Freefall and oldState ~= Enum.HumanoidStateType.Jumping then
		-- Walked off a ledge without jumping: allow the air jumps here too.
		-- Delete these two lines if a fall should not give a jump.
		jumpsLeft = getAirJumps()
	elseif GROUNDED[newState] then
		jumpsLeft = 0
	end
end)

local function airJump()
	jumpsLeft -= 1
	lastJump = os.clock()
	-- Roblox pushes the character up with its normal jump strength and plays the jump animation
	humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
end

-- JumpRequest fires for Space, the phone jump button and the gamepad A button
UserInputService.JumpRequest:Connect(function()
	local now = os.clock()
	local newPress = now - lastRequest > NEW_PRESS_GAP
	lastRequest = now
	if not newPress or jumpsLeft <= 0 or now - lastJump < MIN_SECONDS_BETWEEN_JUMPS then
		return
	end
	if humanoid.Health <= 0 or humanoid.FloorMaterial ~= Enum.Material.Air then
		return -- dead, or still on the ground: Roblox handles a normal jump itself
	end
	if humanoid:GetState() == Enum.HumanoidStateType.Freefall then
		airJump()
	end
end)

You can test it now. With no server Script yet, getAirJumps returns DEFAULT_AIR_JUMPS, so every player gets one extra jump. Step 2 explains each part, and Step 3 lets the server change the number.

Step 2: What each part does

Counting jumps with StateChanged

A change to Jumping that did not come from Freefall is a jump from the floor, so the script hands out the air jumps then. A change to Jumping from Freefall is one of our own air jumps, so it is skipped and does not refill anything. Any grounded state in the GROUNDED table sets jumpsLeft back to 0.

Resetting on landing instead of on the next jump matters. If air jumps only refilled when the player jumped from the ground, a player who walked off a ledge after spending their jumps on the last platform would have none. Resetting on Landed and Running means the count always matches what the player just did. Running is in the table as a backup: if a very short hop goes straight back to Running, the jumps still reset.

Why JumpRequest needs a gap

UserInputService.JumpRequest fires whenever the player asks to jump: Space on a keyboard, the jump button on a phone or A on a gamepad. Roblox's reference warns that it fires several times for a single press. Without MIN_SECONDS_BETWEEN_JUMPS, one press could spend a triple jump in a single frame.

A held button also keeps requesting jumps. If the player holds Space through the first jump, the request would arrive the moment the character enters Freefall and use the air jump right away. NEW_PRESS_GAP only counts a request as a new press when there was a pause of 0.1 seconds with no requests, so the player has to let go and press again.

FloorMaterial as a second check

Humanoid.FloorMaterial is Air when the character is not standing on anything, and the material of the floor otherwise. The script only air jumps when it is Air, so a request in the frame a player lands never counts as an air jump. Roblox does the normal jump from the ground on its own.

Jump height

An air jump uses the same strength as a jump from the ground: Humanoid.JumpHeight, or JumpPower if the Humanoid has UseJumpPower ticked. A jump pad or a game pass that raises it raises the air jumps too. Because the air jump starts a fresh jump, it reaches about the same height above the point where the player pressed, so pressing near the top of the first jump goes highest.

Step 3: Let the server choose the jump count

The LocalScript reads a player attribute called AirJumps. Attributes set by a server Script replicate to that player's device, so the server is the one place that decides who gets a double jump, a triple jump or none. This Script gives everyone one air jump, and two to owners of a game pass if you set its ID.

  1. Hover over ServerScriptService, click + and insert a Script named JumpSettings.
  2. Paste the code below. Leave TRIPLE_JUMP_PASS_ID at 0 until you have made a pass.
Script in ServerScriptService named JumpSettings
-- Script in ServerScriptService named JumpSettings.
-- Decides how many air jumps each player gets. The DoubleJump LocalScript reads it.
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")

local AIR_JUMPS = 1 -- everyone: one extra jump (a double jump)
local PASS_AIR_JUMPS = 2 -- game pass owners: a triple jump
local TRIPLE_JUMP_PASS_ID = 0 -- your game pass ID, or 0 for no pass

local function ownsPass(player: Player): boolean
	if TRIPLE_JUMP_PASS_ID == 0 then
		return false
	end
	-- UserOwnsGamePassAsync asks Roblox's servers and can fail, so wrap it in pcall
	local ok, owns = pcall(function()
		return MarketplaceService:UserOwnsGamePassAsync(player.UserId, TRIPLE_JUMP_PASS_ID)
	end)
	return ok and owns == true
end

local function onPlayerAdded(player: Player)
	player:SetAttribute("AirJumps", AIR_JUMPS)
	if ownsPass(player) then
		player:SetAttribute("AirJumps", PASS_AIR_JUMPS)
	end
end

-- Someone who buys the pass during the game gets the triple jump at once
MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player: Player, passId: number, purchased: boolean)
	if purchased and passId == TRIPLE_JUMP_PASS_ID and TRIPLE_JUMP_PASS_ID ~= 0 then
		player:SetAttribute("AirJumps", PASS_AIR_JUMPS)
	end
end)

Players.PlayerAdded:Connect(onPlayerAdded)
for _, player in Players:GetPlayers() do
	task.spawn(onPlayerAdded, player)
end

The attribute is on the Player, not the character, so it survives respawns. The LocalScript reads it on every jump from the ground, so a change takes effect on the next jump. A power-up that gives a triple jump for 30 seconds is the same idea: set the attribute to 2, then task.delay(30, ...) sets it back.

To set up the pass itself, the purchase button and the purchase prompt, follow the game pass guide. It uses the same UserOwnsGamePassAsync check.

Step 4: Test it

  1. Open the Output window (Window menu, then Output) and press Play.
  2. Jump, then press jump again near the top of the jump. You should go up a second time, and a third press does nothing until you land.
  3. Hold Space the whole time: you should only jump once until you let go and press again.
  4. Walk off a ledge and press jump in the air: you get the air jump. Delete the Freefall lines in the script if you do not want that.
  5. Stop, set AIR_JUMPS to 2 in JumpSettings and play again: you now get two presses in the air.
  6. To try the phone jump button, test with Studio's device emulator set to a phone.

Common errors and fixes

If nothing happens on the second press, check the Output window first: a red line names the script and the line.

The second jump never happens

Check that the LocalScript is in StarterCharacterScripts. In StarterPlayerScripts, script.Parent is not the character and WaitForChild("Humanoid") waits forever. Also check that no other script sets JumpPower or JumpHeight to 0.

One press uses every air jump

The gap between jumps is missing or too short. Keep MIN_SECONDS_BETWEEN_JUMPS at 0.25 or higher and keep the NEW_PRESS_GAP check.

The double jump stops working after a respawn

A LocalScript in StarterCharacterScripts is copied into each new character, so it should restart on its own. If you put the code in StarterPlayerScripts instead, it still points at the old, removed Humanoid.

Infinite jumps

Something keeps refilling jumpsLeft. A common cause is refilling it on every change to Jumping, including our own air jumps. The check oldState ~= Enum.HumanoidStateType.Freefall prevents that.

Build it with RoCode

If you would rather not set this up by hand, RoCode can build it in the place you have open. RoCode is an independent AI agent for Roblox Studio, not made by Roblox: you describe the change in a web chat, and its Studio plugin creates the parts and scripts in your Explorer, so there is no code to paste.

You type

Add a double jump to my obby, and a triple jump for players who own my game pass. Players should get the air jump after walking off a ledge too.

RoCode does
  • Can read your place first to find the scripts you already have, then adds the LocalScript and the server Script next to them
  • Writes the scripts with Create Script and is told to compile-check each one with Check Script
  • Sets an undo point before and after each batch of changes, so Ctrl+Z steps back one batch at a time

After a build, RoCode can run its test robot: it plays your game in Studio and reports PASS or FAIL. It checks only what it chose to test, so jump through your course yourself too. How RoCode connects to Studio.

Questions

How do you make a double jump in Roblox Studio?

Put a LocalScript in StarterCharacterScripts that listens to UserInputService.JumpRequest and calls humanoid:ChangeState(Enum.HumanoidStateType.Jumping) while the Humanoid is in Freefall and has an air jump left. Step 1 has the full script.

How do I make a triple jump in Roblox?

Set DEFAULT_AIR_JUMPS to 2, or set the player attribute AirJumps to 2 from a server Script as Step 3 does.

Does the double jump work on mobile?

Yes. JumpRequest fires for the jump button on a phone and the A button on a gamepad, as well as Space.

Can I make the double jump a game pass?

Yes. Step 3 sets AirJumps from UserOwnsGamePassAsync. Set AIR_JUMPS to 0 and PASS_AIR_JUMPS to 1 to sell the double jump itself.

Why does ChangeState not work in a server Script?

The player's device simulates its own character, so state changes for it have to come from a LocalScript on that device.

Sources and further reading

How the code was checked: every script on this page passes Luau's strict type checker against Roblox's API definitions (luau-lsp, 14 November 2026). A type check catches misspelt APIs and wrong types, not game logic, so playtest in Studio before you publish.

Try RoCode on your own place.

Free every day, no card required. Install the plugin, describe the feature, and review what lands in Studio.