local player = game:GetService("Players").LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local humanoidRootPart = char:WaitForChild("HumanoidRootPart")
local humanoid = char:WaitForChild("Humanoid")
local jumpUsage = 1
local uis = game:GetService("UserInputService")
uis.InputBegan:Connect(function(key, gp)
if key.KeyCode == Enum.KeyCode.Space and not gp then
if humanoidRootPart and humanoid then
if humanoid:GetState() == Enum.HumanoidStateType.Freefall then
if jumpUsage >= 1 then
jumpUsage -= 1
humanoid:ChangeState(Enum.HumanoidStateType.Jumping, true)
humanoid.StateChanged:Connect(function(old, new)
if new == Enum.HumanoidStateType.Landed then
jumpUsage = 1
end
end)
end
end
end
end
end)