A roblox double jump script is honestly the first thing I look for whenever I hop into a new platformer or "obby" on the platform. There's just something about that extra bit of airtime that makes movement feel less clunky and way more responsive. If you're building a game and it feels a little stiff, adding a double jump is probably the easiest way to inject some "juice" into the gameplay without needing to redesign your entire map.
In this guide, we're going to break down how to actually get this working. We aren't just going to copy-paste some code and call it a day; I want to walk you through why the script works the way it does. That way, when you want to tweak it later—maybe for a triple jump or a jetpack—you actually know which knobs to turn.
Why Movement Mechanics Matter
Before we dive into the Luau code, let's talk about why we care. In Roblox, the default character controller is fine. It's functional. But it's very "standard." When you add a double jump, you're giving the player a second chance. Missed a ledge? Jump again. Need to dodge a projectile in a combat game? Double jump.
It changes the level design, too. If players can double jump, you can make gaps wider and obstacles taller. It adds a layer of skill, especially if you time the second jump to maximize distance. It's a tiny feature, but it's a foundational one.
The Logic Behind the Double Jump
To make a roblox double jump script work, we have to listen for when the player presses the jump key (usually Spacebar). But there's a catch: the game already handles the first jump automatically. If we just listen for the Spacebar, we might trigger the "double" jump while the player is still standing on the ground.
The logic usually goes like this: 1. The player jumps once (handled by Roblox). 2. We check if they are currently in the air. 3. If they are in the air and haven't used their "extra" jump yet, we let them jump again. 4. Once they hit the ground, we reset the ability so they can do it all over again.
We'll be using a LocalScript for this because player movement is best handled on the client side to keep things feeling snappy and lag-free.
Setting Up Your Script
First things first, you'll want to head over to StarterPlayer in your Explorer window, then look for StarterCharacterScripts. Right-click that folder and insert a new LocalScript. You can name it "DoubleJumpScript" or whatever makes sense to you.
Here is a solid, clean way to write a roblox double jump script:
```lua local UserInputService = game:GetService("UserInputService") local player = game.Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local humanoid = character:WaitForChild("Humanoid")
local canDoubleJump = false local hasDoubleJumped = false local oldJumpPower = humanoid.JumpPower local DOUBLE_JUMP_POWER_MULTIPLIER = 0.8 -- Make the second jump slightly weaker
-- This function handles the jump logic local function onJumpRequest() if not character or not humanoid or not character:IsDescendantOf(workspace) then return end
-- Check if the player is in the air and hasn't double jumped yet if canDoubleJump and not hasDoubleJumped then hasDoubleJumped = true -- Apply the "jump" force manually humanoid.JumpPower = oldJumpPower * DOUBLE_JUMP_POWER_MULTIPLIER humanoid:ChangeState(Enum.HumanoidStateType.Jumping) end end
-- Monitor the humanoid's state to see when they land or jump humanoid.StateChanged:Connect(function(oldState, newState) if newState == Enum.HumanoidStateType.Landed then -- Reset everything when they touch the ground canDoubleJump = false hasDoubleJumped = false humanoid.JumpPower = oldJumpPower elseif newState == Enum.HumanoidStateType.Jumping then -- They've used their first jump, so they're allowed to double jump now wait(0.1) -- Small delay to prevent accidental instant double-taps canDoubleJump = true elseif newState == Enum.HumanoidStateType.Freefall then -- This handles cases where they fall off a ledge without jumping wait(0.1) canDoubleJump = true end end)
UserInputService.JumpRequest:Connect(onJumpRequest) ```
Breaking Down the Code
Let's look at what's actually happening here.
The UserInputService
We use UserInputService.JumpRequest because it's specifically designed to fire whenever the game thinks the player wants to jump. It's better than just checking for the Spacebar because it also accounts for mobile players tapping the jump button or console players using a controller.
The State Check
The humanoid.StateChanged part is the "brain" of the script. We need to know exactly what the character is doing. If the state is Landed, we reset our variables. If it's Jumping, we toggle canDoubleJump to true.
I added a tiny wait(0.1) in there. You might think, "Why wait?" Well, without that delay, the script often registers the first jump and the second jump almost simultaneously if you're a heavy-handed typer. That tenth of a second ensures the player actually has to be in the air before the double jump becomes available.
Customizing the Feel
Notice the DOUBLE_JUMP_POWER_MULTIPLIER. I personally think it feels a bit more "realistic" (if you can call a double jump realistic) when the second jump isn't quite as powerful as the first. It feels like the character is pushing off the air itself, which wouldn't give you as much leverage as the solid ground. You can change this to 1.0 if you want them to be equal, or even 1.5 if you want a super-jump effect.
Adding Some Polish
A roblox double jump script works fine on its own, but if you want your game to look professional, you need visual feedback. If a player jumps in mid-air and nothing happens visually, it can look a bit "glitchy."
Particle Effects
Think about adding a little "poof" of dust or a ring of wind under the player's feet when the second jump triggers. You can do this by keeping a ParticleEmitter inside the character's RootPart and using Emit() when the hasDoubleJumped variable becomes true.
Sound Effects
Sound is half the experience. A subtle "whoosh" or a higher-pitched jump sound for the second leap makes the action feel much more satisfying. You can load a sound into the script and use :Play() right when the state changes to Jumping for the second time.
Common Problems and How to Fix Them
Sometimes things don't go according to plan. Here are a few things I've run into while messing with double jumps:
1. The Infinite Jump Glitch If you forget to check hasDoubleJumped, the player might be able to jump infinitely, effectively flying through your level. Always make sure that boolean is set to true the moment the second jump happens and doesn't get set back to false until the Landed state is triggered.
2. Falling Off Ledges If a player walks off a ledge without jumping, they enter the Freefall state. In my script above, I included a check for Freefall. This allows players to "double jump" even if they didn't do a first jump. Most modern games do this because it feels more fair to the player. If you want to be strict, you can remove that Freefall check so they must jump from the ground first.
3. Jump Power vs. Jump Height Roblox recently changed how jumping works with the UseJumpPower property. If your game uses JumpHeight instead, the script might not work as expected. Make sure your character's Humanoid has UseJumpPower checked, or update the script to modify humanoid.JumpHeight instead.
Final Thoughts
Adding a roblox double jump script is a fantastic "Level 1" scripting project. It touches on user input, humanoid states, and character manipulation—three things you'll use constantly in Roblox development.
Once you get the hang of this, try experimenting! Maybe try making a triple jump, or a dash mechanic that uses similar logic. The sky's the limit (literally, if you set the JumpPower high enough). Movement is the core of almost every game, so taking the time to make it feel "right" is always worth the effort. Happy developing!