Hello,
So I’m trying to make a randomized animation player for an NPC in a game. I try to load the animation with Animator:LoadAnimation()
but an error pops up (picture below).
Here is the script that causes the error:
local dances = { -- There are some animation ids in here but they take up too much space so I deleted them
}
task.wait(0.5)
local animation = script:WaitForChild('Animation')
animation.AnimationId = dances[math.random(1, #dances)]
local humanoid = script.Parent:WaitForChild('Humanoid')
local dance = humanoid.Animator:LoadAnimation(animation)
dance:Play()
Here is an Id I used: 3333499508
I tried checking if the id was an animation using if MarketplaceService:GetProductInfo(Animation.AnimationId).AssetTypeId == 24 then
but the error still occurred.
(*I checked in AssetType | Documentation - Roblox Creator Hub to see the Id types)
Any ideas?
Thank you!