Am I doing it right? Switching AssetIds

So, I’ve this piece of code:

-- LocalScript - In an tool.Activated event
local curstage = 0
local maxStage = 2

local Switch_AnimId = {
    [0] = function() return "rbxassetid://XXXXXXXX" end,
    [1] = function() return "rbxassetid://YYYYYYYY" end,
    [2] = function() return "rbxassetid://ZZZZZZZZ" end,
}
local animation = Instance.new("Animation")
animation.AnimationID = Switch_AnimId[curstage]()

local track = humanoid:LoadAnimation(animation)
curStage += 1
-- ...

The question is:
Switching AssetIDs makes the client to download the animations everytime that it occurs? Or somehow the server download and saves the animation an unique time?

1 Like
  • If you put the animaton in a local script it will not replicate to the server, and I think that means that the client is downloading the animation.

  • But other players will not see the animaton unless you put the animaton in a server script

But, I think the animations are saved on each client on a local script, not on the setver

1 Like

Sorry for the previous Comment, I meant, It should cache on the first usage of the animation then use that cached keyframe. So bascially you just have to load it once. You can also use PreloadAsync. These are just hypothesis.

1 Like

Myself I’d load them to variables … that would preload them once.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.