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

Why won't this script work on multiplayer servers?

The code below is in a regular script, placed inside an NPC. The script works perfectly in test mode on studio but doesn't work in a multiplayer server, even if I'm the only person in the game.

The animation is one that I've made myself and is on my account.

wait(3)
Animation = Instance.new("Animation")
Animation.AnimationId = "http://www.roblox.com/Asset?ID=234539352"
animTrack = script.Parent.Humanoid:LoadAnimation(Animation)
 
animTrack:Play()

There are no errors on the developer panel either.

Could anyone tell me what I need to do fix this?

Thanks.

1 comment

0

Also, please refrain from posting the same question repeatedly, at least until it no longer displays on the front page.

1 answer

As per this page of the wiki, you have to use an AnimationController object to play animations in NPCs:

wait(3)
local controller = Instance.new("AnimationController", script.Parent)

Animation = Instance.new("Animation")
Animation.AnimationId = "http://www.roblox.com/Asset?ID=234539352"
animTrack = controller:LoadAnimation(Animation)

animTrack:Play()

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