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

How do I preload animations?

Asked by 6 years ago

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
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. BlackOrange3343 2676 — 6y

Answer this question