So, when I made a sword tool, I’ve used Humanoid.Running to determine when the walk animation is playing or not but I’ve ran into a bug, the animation switches to the idle animation every time the player makes a turn, and it glitches out the animations.
Here is the script:
script.Parent.Parent.Humanoid.Running:Connect(function(speed)
if speed > 0.75 then
runningtrack = script.Parent.Parent.Humanoid:LoadAnimation(anim3)
runningtrack.Priority = Enum.AnimationPriority.Movement
runningtrack.Looped = true
runningtrack:Play()
else
runningtrack:Stop()
track:Play()
end
end)
Although, my animation is still fuzzing whenever I am making a turn.
(If you look at the legs of the player, you will see they are glitching around).
Try just lowering the speed requirement from 0.75, it could be that during those turns you’re dropping below the speed requirement.
Additionally, you probably don’t want to be loading the animation with every .Running signal where Speed > n. Spamming Play() and Stop() won’t do much harm, but it also won’t do any good either, so I added a little check in your script:
-- Create the AnimTrack & set its properties here
runningTrack = script.Parent.Parent.Humanoid:LoadAnimation(anim3)
runningTrack.Priority = Enum.AnimationPriority.Movement
runningTrack.Looped = true
-- A little running bool check so that Play() and Stop() aren't spammed
local Running = false
-- Actual function
script.Parent.Parent.Humanoid.Running:Connect(function(Speed)
if not Running and Speed > 0.50 then
Running = true
runningTrack:Play()
elseif Running and Speed <= 0.50
Running = false
runningTrack:Stop()
track:Play()
end
end)