This is one of my custom animations that overrides the default jump animation. It works fine, but once I reset, the animation and the double jump don't work anymore. I have a feeling that it has to do with my script still being locked to the dead Humanoid even after the character respawns, but even if this is the case, I'm not sure what I would do about it
player = game:GetService("Players").LocalPlayer mouse = player:GetMouse() c = player.Character or player.CharacterAdded:Wait() humanoid = c:WaitForChild("Humanoid") humanoid.WalkSpeed = 30 Flip = Instance.new("Animation") Flip.AnimationId = "rbxassetid://4378710738" canDoubleJump = true game:GetService("UserInputService").InputBegan:Connect(function(input) if input.KeyCode == Enum.KeyCode.Space then c.Humanoid.JumpPower = 100 if c.Humanoid:GetState() == Enum.HumanoidStateType.Freefall and canDoubleJump then c.Humanoid.JumpPower = 60 c.Humanoid:ChangeState(Enum.HumanoidStateType.Jumping) humanoid:LoadAnimation(Flip):Play() canDoubleJump = false end end humanoid.StateChanged:Connect(function(old, new) if new == Enum.HumanoidStateType.Landed and old == Enum.HumanoidStateType.Freefall then canDoubleJump = true end end)
I found the solution. Apparently, this code below doesn't work.
player.CharacterAdded:Wait()
Instead, do
repeat wait() until game.Players.LocalPlayer.Character character = player.Character or player.CharacterAdded:Wait()