This script is supposed to make it so that if I try to jump or walk as the animation plays nothing will happen but after the animation is done i can. It works when only walking is involved but whenever i jump before or after the animation i can no longer play the animation. Help?
Player = game.Players.LocalPlayer Tool = script.Parent.Parent Animation = script:WaitForChild("Animation") Enabled = true Tool.Equipped:Connect(function(mouse) mouse.KeyDown:Connect(function(key)
if not Enabled then return end
Enabled = false
if key == "j" then
local Humanoid = Player.Character.Humanoid
local animationtrack = Player.Character.Humanoid:LoadAnimation(Animation)
Humanoid.WalkSpeed = 0
Humanoid.JumpPower = 0
animationtrack:Play()
wait(2)
Humanoid.WalkSpeed = 20
Humanoid.JumpPower = 20
wait(.5)
Enabled = true
end
end)
end)
