#How do I stop a running animation from playing when the player isn't moving

1 messages · Page 1 of 1 (latest)

random iron
#

I tried to use a state manager but everyone says it's outdated and i found it from a video is there any other way that works

#
local player = game:GetService('Players').LocalPlayer


local rig = script.Parent
local humanoid = rig:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")


local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://83314579185606"
local animationTrack = animator:LoadAnimation(animation)
local run = "run"
local Idle = "Idle"
local duration = nil




UIS.InputBegan:Connect(function(input,gameproc)
    

    if input.KeyCode == Enum.KeyCode.LeftShift then
        animationTrack.Looped = true
        animationTrack:Play()
        humanoid.WalkSpeed = 60
        animationTrack:Play()
        for _,animation in ipairs(animator:GetPlayingTracks()) do
            if animation.Name == "Run" then
                animation.Priority = Enum.AnimationPriority.Action2
            end
        end
    end
end)


UIS.InputEnded:Connect(function(input,gameproc)
    if input.KeyCode == Enum.KeyCode.LeftShift then
        animationTrack:Stop()
        humanoid.WalkSpeed = 16
        animationTrack.Looped = false
    end
end)```
#

ill use a one time running script instead of it being universal

sly granite