How to play an Animation in Game Play?

How to play an Animation in Game Play?

I have my avatar and animation playing using the Animation Editor.
It’s a custom rig -->Animation Controller -->Animator

I would like to run this animation during game play.

  • How can I run the same character animation in the Game Play?

Thx a lot for any little info & ideas.

you have to define the track first

local animation = Humanoid:LoadAnimation(animobject) -- you can also use animator


animation:Play()

this will be inside a localscript
make sure to upload the animation and enter the id on the animation object

btw wrong category

Thank you so much, appreciate it!

I am not using a Humanoid object, instead I am using the AnimationController. It’s not a GamePlayer animation, just a custom animation I would like to run during gameplay, preferable with a button. Meaning, you click a button, the animation starts. You click the button again and the animation stops.

It’s a custom rig and animation from the mixamo platform.

Here is my script:

local animationController = script.Parent.Parent:FindFirstChild("AnimationController")
if not animationController then
	error("AnimationController not found")
	return
end

local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://16747289882"  -- Your animation ID

-- Load and play the animation
local animationTrack = animationController:LoadAnimation(animation)
animationTrack:Play()

The animation is playing in runtime. But there is one hiccup.
It looks like the characters world position does not change, and the mesh is “stuck.”.
It looks like the root bone is blocked or prohibited to move in world space.

The animation runs great within the Animation Editor. However, in game-play mode, the mesh doesn’t seem to be able to use the root bone animation keys.

It’s hard to describe, and much easier to see when you smash the play button.

The .rbxl file attached below:
animation_test.rbxl (122.0 KB)

Blender file:
mixamo_animation_test.zip (1.9 MB)

Hmmm… I was searching for a while now for a solution, but no luck.

It seems I am not the only one having that issue.
Here another post, with the exact same problem:

Thank you so much for any ideas and thoughts that could resolve that issue,
appreciate it!