local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local canDoubleJump = true
local canDoubleJumpAfter = 0.5 -- Cooldown between jumps
local jumpPower = 50 -- Power of the double jump
local jumpCount = 0 -- Counter for jumps
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://102530887322106"
local track = humanoid:LoadAnimation(animation)
local function onJumpRequest()
if humanoid:GetState() == Enum.HumanoidStateType.Freefall and jumpCount < 1 then
track:Play()
track:GetMarkerReachedSignal("Jump"):Connect(function()
jumpCount = jumpCount + 1
humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
humanoid:Move(Vector3.new(0, jumpPower, 0))
wait(canDoubleJumpAfter)
end)
end
end
UserInputService.InputBegan:Connect(function(input, gameProcessed)
if input.UserInputType == Enum.UserInputType.Keyboard and input.KeyCode == Enum.KeyCode.Space and not gameProcessed then
onJumpRequest()
end
end)
humanoid.StateChanged:Connect(function(_, newState)
if newState == Enum.HumanoidStateType.Landed or newState == Enum.HumanoidStateType.Running then
jumpCount = 0
end
end)
** You are now Level 2! **