local u=game:GetService("\085\115\101\114\073\110\112\117\116\083\101\114\118\105\099\101")local R=game.Players.LocalPlayer local X=R.Character or R.CharacterAdded:Wait()local S=X:WaitForChild("\072\117\109\097\110\111\105\100")local V=0 local Q=false S.StateChanged:Connect(function(u,R)if Enum.HumanoidStateType.Landed==R then V=0 Q=false elseif Enum.HumanoidStateType.Freefall==R then wait(JumpCooldown)Q=true elseif Enum.HumanoidStateType.Jumping==R then Q=false V+=1 end end)u.JumpRequest:Connect(function()if Q and V<MaxJumps then S:ChangeState(Enum.HumanoidStateType.Jumping)end end)


local UIS = game:GetService("UserInputService")
local Player = game.Players.LocalPlayer
local Char = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Char:WaitForChild("Humanoid")
local NumJumps = 0
local canjump = false

Humanoid.StateChanged:Connect(function(oldstate, newstate)
	if Enum.HumanoidStateType.Landed == newstate then
		NumJumps = 0
		canjump = false
	elseif Enum.HumanoidStateType.Freefall == newstate then
		wait(JumpCooldown)
		canjump = true
	elseif Enum.HumanoidStateType.Jumping == newstate then
		canjump = false
		NumJumps += 1
	end
end)

UIS.JumpRequest:Connect(function()
	if canjump and NumJumps < MaxJumps then
		Humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
	end
end)
