So I made this NPC that has an animation that plays in it, it worked in studio but in game I got an error that the animation wasn't loading so I added preload async and it loads it but the animation doesn't play in game or studio.

local ContentProvider = game:GetService("ContentProvider")

local animation = Instance.new("Animation", script.Parent)
animation.AnimationId = "http://www.roblox.com/Asset?ID=1289556847"
local animController = Instance.new("AnimationController", script.Parent)
local animTrack = animController:LoadAnimation(animation)

local items = {animTrack}

ContentProvider:PreloadAsync(items)

print("Animation loaded")

while true do
	print("looped")
animTrack:Play()
wait(5.6)
animTrack:Stop()
end

1 comment

0

dude just try adding a wait or put a folder inside ReplicatedStorage and name it 'Animations', add a animation and put the Id in then get it there. Why Instance.new.