How to preload animations?

I tried this and it doesn’t work:

local contentprovider = game:GetService("ContentProvider")
Default = "rbxassetid://5910932026"
contentprovider:Preload(Default)
2 Likes

It looks like you’re using the ContentProvider wrong. The function is called ‘PreloadAsync’ and it accepts a table of instances. It then loads all the files and stuff used in that instance. Here is an example:

local ContentProvider = game:GetService("ContentProvider")
local loadAnimation = Instance.new("Animation")
loadAnimation.AnimationId = "rbxassetid://5910932026"
ContentProvider:PreloadAsync({loadAnimation})

You can read about it here:

13 Likes

Alright, I’ll give it a go and let you know how it goes.

If I wanted to preload multiple animations, how would I set it up?

-- ...
local loadAnimation1 = Instance.new("Animation")
loadAnimation.AnimationId = "rbxassetid://5910932026"
local loadAnimation2 = Instance.new("Animation")
loadAnimation.AnimationId = "rbxassetid://5910932026"
local animations = {loadAnimation1, loadAnimation2}
ContentProvider:PreloadAsync(animations)

or

-- ...
local loadAnimation1 = Instance.new("Animation")
loadAnimation.AnimationId = "rbxassetid://5910932026"
local loadAnimation2 = Instance.new("Animation")
loadAnimation.AnimationId = "rbxassetid://5910932026"
ContentProvider:PreloadAsync({loadAnimation1, loadAnimation2})
4 Likes

There is a much simpler way to Pre-Load animations.
Creat a Local Script in Replicated First and put this
Make sure you Animations are in a folder inside the local script and name the folder to ‘Animations’

local CP = game:GetService("ContentProvider")
local Animations = script:WaitForChild("Animations")

warn("Preloading Animations...")
CP:PreloadAsync(Animations:GetChildren())
warn("Animations Loaded!")
15 Likes

I tried both, but it gives me this regardless. Here’s the last code I put in:

Are they your animations, like did you export them?

Yeah, they’re mine. Not sure why it doesn’t work.

Are you sure usally I see this error if it’s not my animation or owned my me or my group. Also check if the id’s are inputed right, could you also show a screenshot fo the way it’s setup in replicated first.

Yeah, they’re my animations.

Yeah, I have a tool with all the IDs loaded in to work with the object. Since it’s already scripted to work and with animations properly replicating there, that’s alright.

image

I am not sure why it’s not working then, Mabey it’s an issue with studio try restarting it, that might fix it.

It’s happening in the server as well tho.

Then I am not sure because they should load, Mabey it’s an issue with the actual animation, try reporting it to bug reports or something like that because I am not sure why it doesn’t work

Works perfectly for me. Thanks!

I know this topic is kinda old, but you should try ‘rbxassetid://AnimationIDHere’ instead of ‘http://www.roblox.com/asset/?id=AnimationIDHere’.


  • Tsu Washington / SovietFurryBruh.
5 Likes

Quite clever, working greatly !

1 Like