Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Unable to cast value to object Humanoid:LoadAnimation()?

alright oso im trynna load a animation to my avatar and whenever i run this script it says unable to cast value to an object

game.Workspace.Slixicidal.Humanoid:LoadAnimation(2917553081)

i tried it with rbxasset but it didnt work

1 answer

You can't load an animation by it's robloxid.

You should first create the animation, then replace the id to the animation instance.

local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://291755308"

local Human = game.Workspace:FindFirstChild("Slixicidal")

if Human then
   local Humanoid = Human.Humanoid
   local AnimationTrack = Humanoid:LoadAnimation(Animation)
   AnimationTrack:Play()
end

Hope this helps !

This discussion is preserved as it was. New answers, comments, and votes are closed.