0 views0 copies0 likes

Double Jump Controller for Platformers

Universal script

Copy it, then test it in your own Studio place.

Combat & movement Verified

Script code

25 lines ยท 1.0 KB
Download
local Input = game:GetService("UserInputService")local player = game:GetService("Players").LocalPlayerlocal humanoid, stateConnectionlocal firstJump, spent = 0, falselocal function bind(character)	if stateConnection then stateConnection:Disconnect() end	humanoid = character:WaitForChild("Humanoid")	firstJump, spent = 0, false	stateConnection = humanoid.StateChanged:Connect(function(_, state)		if state == Enum.HumanoidStateType.Jumping and not spent then			firstJump = os.clock()		elseif state == Enum.HumanoidStateType.Landed or state == Enum.HumanoidStateType.Running then			firstJump, spent = 0, false		end-- โ€ฆopen Get script for the full source

About this script

Drop this LocalScript into StarterPlayerScripts to give players one extra airborne jump in your platformer. It listens to Roblox's jump request, so the input comes through the built-in jump control on desktop and mobile. Leaving the ground from a normal jump arms the extra boost after a short delay, and landing resets it. Test tapping twice, running off a ledge and resetting midair.

Comments

Share what works, ask questions, or report an issue.

0

Log in to leave a comment.

No comments yet

Be the first to share your thoughts!

Raw Luau source

local Input = game:GetService("UserInputService")
local player = game:GetService("Players").LocalPlayer
local humanoid, stateConnection
local firstJump, spent = 0, false
local function bind(character)
	if stateConnection then stateConnection:Disconnect() end
	humanoid = character:WaitForChild("Humanoid")
	firstJump, spent = 0, false
	stateConnection = humanoid.StateChanged:Connect(function(_, state)
		if state == Enum.HumanoidStateType.Jumping and not spent then
			firstJump = os.clock()
		elseif state == Enum.HumanoidStateType.Landed or state == Enum.HumanoidStateType.Running then
			firstJump, spent = 0, false
		end
	end)
end
player.CharacterAdded:Connect(bind)
if player.Character then bind(player.Character) end
Input.JumpRequest:Connect(function()
	if not humanoid or humanoid.Health <= 0 or spent or firstJump == 0 then return end
	if humanoid:GetState() == Enum.HumanoidStateType.Freefall and os.clock() - firstJump > 0.16 then
		spent = true
		humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
	end
end)