Basically, I’ve made a script of idle, walk forward, backwards and sideways when you equip a tool.
tool.Equipped:Connect(function()
equipped = true
IdleTrack = Char.Humanoid:LoadAnimation(idle)
IdleTrack:Play()
IdleTrack.Priority = Enum.AnimationPriority.Core
game:GetService("RunService").RenderStepped:Connect(function()
local Speed = (Char.HumanoidRootPart.Velocity).Magnitude
if not RunningForward and Speed > 0.50 and equipped and Char.Humanoid.MoveDirection.Z > 0 and _G.SHeld == false and _G.WHeld == true then
Running = true
RunningForward = true
RunningBackward = false
RunningSideways = false
IdleTrack:Stop()
if BackwardTrack then
BackwardTrack:Stop()
end
ForwardTrack = Char.Humanoid:LoadAnimation(Forward)
ForwardTrack:Play()
elseif not RunningBackward and Speed > 0.50 and equipped and Char.Humanoid.MoveDirection.Z < 0 and _G.WHeld == false and _G.SHeld == true then
Running = true
RunningBackward = true
RunningForward = false
RunningSideways = false
IdleTrack:Stop()
if ForwardTrack then
ForwardTrack:Stop()
end
BackwardTrack = Char.Humanoid:LoadAnimation(Backward)
BackwardTrack:Play()
elseif not RunningSideways and Speed > 0.50 and equipped and Char.Humanoid.MoveDirection.Z == 0 then
Running = true
RunningSideways = true
RunningBackward = false
RunningForward = false
IdleTrack:Stop()
if BackwardTrack then
BackwardTrack:Stop()
end
ForwardTrack = Char.Humanoid:LoadAnimation(Forward)
ForwardTrack:Play()
elseif Running and Speed <= 0.50 and equipped then
Running = false
RunningBackward = false
RunningForward = false
RunningSideways = false
if ForwardTrack then
ForwardTrack:Stop()
end
if BackwardTrack then
BackwardTrack:Stop()
end
IdleTrack:Play()
end
end)
end)
However, when I try to play the idle animation, the “ForwardTrack” just won’t stop and it keeps on topping the idle animation.
Video of the problem:
As you can see in the video, the animation keeps on playing if I stop.
Thank you for reading and possibly helping