Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 5 years ago

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

Log in to vote
0
Answered by 5 years ago

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 !

Ad

Answer this question