Trying to animate parts?

Hi, I’ve recently been trying out animating parts for this scene in my roblox game. this script doesn’t seem to work and gives me the same error. (Unable to cast value to Object)

my explorer:

Screenshot 2025-04-23 175032

my server script:

local hum = script.Parent.Humanoid

local id = 113296684966908

local track = script.Parent.AnimationController:LoadAnimation(id)

track:Play()

You need to create an animation object, then load the animation object to the animation controller

2 Likes

Try

local hum = script.Parent.Humanoid

local id = 113296684966908

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

local track = script.Parent.AnimationController:LoadAnimation(animation)

track:Play()

no error but the animation just doesnt play

got it working guys! with this script :smiley:

local hum = script.Parent.Humanoid

local id = 113296684966908
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://113296684966908"

local track = script.Parent.HumanoidRootPart.AnimationController:LoadAnimation(anim)

track:Play()

edit: forgot to mention the humanoid root part is the only part being animated.