Animation not stopping

Hi there. My animation won’t stop, even when it’s being told in the script. Could someone help me fix the issue?

-- Variables
local cs = game:GetService("Chat")

local animations = script.Parent.Parent.Decor.Cashier.Animations
local idle = script.Parent.Parent.Decor.Cashier.Humanoid:LoadAnimation(animations.Idle)
local rob = script.Parent.Parent.Decor.Cashier.Humanoid:LoadAnimation(animations.Robbery)
rob.Looped = false

local possibleChats = {"Take the money!", "It's all in the register!", "It's all there, take it!"}

-- Main
idle:Play()

script.Parent.RobPart.ProximityPrompt.PromptButtonHoldBegan:Connect(function()
    idle:Stop()
    rob:Play()
    cs:Chat(script.Parent.Parent.Decor.Cashier.Head, possibleChats[math.random(1, #possibleChats)])
end)

rob.Stopped:Connect(function()
    rob:Stop()
    idle:Play()
end)

Are you getting any errors, or is the output clear? Without more information, it’s hard to help, seeing as the script itself seems like it will run fine.

There are no errors inside the output.

Pretty sure the event is .Ended, not .Stopped.

The way to load animations currently is Humanoid.Animator:LoadAnimation() which is not seen inside of this.

I did try Ended, and it still didn’t work

This method still works iirc, it’s just deprecated.

Alright. You should use the Animator Instance to load animations as @DoggoImagesYT said.
If that doesn’t work, try using :GetMarkerReachedSignal and add a marker right at the end and call it something like “Finished”.
Alternatively, you could use :KeyframeReached().

1 Like

I had the same issue a while ago, and using it. Fixed it

1 Like

Interesting – I’m using the older method (was not aware of Animator, haven’t really worked with animations in a while) and it works fine on my side.

EDIT: No I’m not, lol, I’m using the Animator instance. Ignore me haha

Another issue I’m having with this, is the animation also loops, when when I’ve added rob.Looped = false inside the script

It felt like a shadow update to me, I never even saw anything about Animator being the new way to Load Animations when it changed lol.

1 Like

Export the animation without looping in the animation editor

1 Like

Did you make the animation? If so, try updating the actual uploaded Animation by disabling the looped setting in the Animation editor

1 Like

any updates? Did anything that we suggested work?