Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Animation loop script suddenly no longer working?

Asked by 4 years ago

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!

0
try to relog or make while wait() do Blackbooks 138 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

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!

Ad

Answer this question