How to play Custom Rig Animation

I made a Custom rig with animations in it but I don’t know how to play the animation. I used
local animation = script:WaitForChild(‘Animation’)
local humanoid = script.Parent:WaitForChild(‘Humanoid’)
local dance = humanoid:LoadAnimation(animation)
dance:Play()

but it doesn’t work. I’m not sure if Im supposed to put Humanoid in the model

1 Like

A rig’s hierarchy should look something like this:

Model
    Humanoid/AnimationController
        Animator
    Part(s)
        (ideally Motor6Ds would go here but it doesn't really matter apart from organizational purposes)

You should be using the animator object to load the animation, not the humanoid, and the humanoid should be inside of the model in which everything else is located.

2 Likes

so how do you make it play the animation?

1 Like

local anim = Instance.new(“Animation”)

anim.AnimationId = “rbxassetid:7853253557”

local controller = Workspace.FBXImportGeneric.AnimationController – path to Humanoid/AnimationController

controller:LoadAnimation(anim):Play()

I did this but it doesnt work

First things first. You are not defining the “dance” animation. Try this:

local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://7853253557"
local humanoid = script.Parent:WaitForChild("Humanoid")
local track

track = humanoid:LoadAnimation(animation)
track.Priority = Enum.AnimationPriority.Action -- either action, core, idle, or movement
track.Looped = false
track:Play()

Also sometimes with animations, If you do not own the animation, It will not work. try checking if you own the animation before running the code again.

4 Likes

Ok thanks also I realized its rbxassetid://(then Id)

1 Like

No problem! :+1:
(char limits…)

1 Like