First of all, I tried making it so an animation could play at the second jump but I messed up. Second of all I wanted the JUMP_FORCE to affect the first jump and not only the second jump. Btw, every time I test it there is that 1 jump at the start that would make you jump so high for some reason. Is there a way to fix that as well? Thanks.
local player = game.Players.LocalPlayer local character = player.Character or player.CharacterAdded:wait() local humanoid = character:WaitForChild("Humanoid") local humanoidrootpart = character:WaitForChild("HumanoidRootPart") local JUMP_FORCE = script:WaitForChild("JUMP_FORCE") local MAX_JUMPS = script:WaitForChild("MAX_JUMPS") local JUMP_CONTROL = Enum.KeyCode.Space local numjumps = 0 local anim = Instance.new("Animation") anim.AnimationId = "http://www.roblox.com/asset/?id=1078047967" function jump(basepart, power) local oldvel = basepart.Velocity basepart.Velocity = Vector3.new(oldvel.x, power, oldvel.z) end game:GetService("UserInputService").InputBegan:connect(function (key) if key.KeyCode == JUMP_CONTROL then if numjumps >= 1 and numjumps < MAX_JUMPS.Value then local playAnim = humanoid:LoadAnimation(anim) playAnim:Play() numjumps = numjumps + 1 jump(humanoidrootpart, JUMP_FORCE.Value) end end end) humanoid.FreeFalling:connect(function(falling) if not falling then numjumps = 0 end if falling and numjumps == 0 then numjumps = 1 end end) humanoid.Jumping:connect(function(jump) if jump then numjumps = 1 end end)