Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Animation loop script suddenly no longer working?

So I have this script for an NPC, where the animation loops over and over on the server. The script worked perfectly fine for a while. Suddenly, I go to test it today, and the animation is not playing. The script is within ServerScriptService.

local animation = Instance.new("Animation", script.Parent)
animation.AnimationId = "rbxassetid://5412563718"
local Endo = workspace:WaitForChild("Backroom Endo")
local AT = Endo.Humanoid:LoadAnimation(animation)

while true do
	AT:Play()
	AT.Stopped:wait()
end

The only thing I've changed since is adding a menu Gui, but I don't see how that would affect this? If anyone can spot anything wrong, then thank you!

1 comment

0

try to relog or make while wait() do

1 answer

Well, I would like you to use AnimationTrack.Looped property of the Animation Track. The following illustrates how you can use it.

local animation = Instance.new("Animation", script.Parent)
animation.AnimationId = "rbxassetid://5412563718"
local Endo = workspace:WaitForChild("Backroom Endo")
local AT = Endo.Humanoid:LoadAnimation(animation)

AT.Looped = true
AT:Play()

If you need more information, you can go to this page to learn more: https://developer.roblox.com/en-us/api-reference/property/AnimationTrack/Looped

Lemme know if it helps!

This discussion is preserved as it was. New answers, comments, and votes are closed.