I found there are no double jump scripts that were very reliable lying around on the internet so I created this - a system that always allows you to jump no matter how laggy your device:
local JUMP_MULTI = 2 -- How many times your jump height is multiplied
local MAX_EXTRA_JUMPS = 1 -- 0 = Single jump; 1 = Double jump; etc
local RunService = game:GetService("RunService")
local Player = game.Players.LocalPlayer
local Character = Player.Character
if Character == nil then Player.CharacterAdded:Wait() end
local Humanoid = Character:WaitForChild("Humanoid")
local Material = Enum.Material
local StateType = Enum.HumanoidStateType
local boostCount = 0
local lastJump = false
RunService.RenderStepped:Connect(function()
if Humanoid.FloorMaterial == Material.Air or boostCount == 0 then return end
boostCount = 0
Humanoid.JumpHeight /= JUMP_MULTI
end)
local function Boost()
if boostCount >= MAX_EXTRA_JUMPS then return end
if boostCount == 0 then Humanoid.JumpHeight *= JUMP_MULTI end
boostCount += 1
Humanoid:ChangeState(StateType.Jumping)
end
RunService.RenderStepped:Connect(function()
if Humanoid.Jump == true and Humanoid.FloorMaterial == Material.Air and lastJump == false then Boost() end
lastJump = Humanoid.Jump
end)
Feel free to use it anywhere