How to Play Animation on Skinned Mesh

Hello, I want to make an entity for my game and I was importing a skinned mesh for it. But I am having trouble playing an Idle animation for it as it isn’t loading in. I’ve looked up other resources but it doesn’t seem to work, any help?

My entity:
scratcher

Code:

--Variable--
local Entity = script.Parent
local hum = Entity.Humanoid
local humrp = Entity.HumanoidRootPart
local Animator = hum.Animator

local IdleAnim = script.Animations.Idle
Animator:LoadAnimation(IdleAnim):Play()

Yes I have checked the animation ID it is correct, yes the Animator is in the humanoid, everything is correctly placed. The animation just won’t play, but the script IS telling me it is playing. But it won’t visually play it.

I’m not sure if this is the right topic since this is mainly a scripting issue, but hopefully someone is able to help me as I’ve been stuck on this for awhile now.

3 Likes

Is this a Server Script? If yes, try to view if the animation is playing in Server View.
If the animation isn’t even playing in Server View.

Try this

--Variable--
local Entity = script.Parent
local hum = Entity:FindFirstChildWhichIsA("Humanoid")
local humrp = Entity.HumanoidRootPart
local Animator = hum.Animator

local IdleAnim = script.Animations.Idle
hum:LoadAnimation(IdleAnim):Play()

Already tried the deprecated version, nothing changed either.

Is this a Server Script? If yes, try to view if the animation is playing in Server View.

Did you try it? And any output?

I want to revive this thread as I’m still having issues with it.

I’ve been looking into AnimationControllers curious to see if it would have anything to do with my problem. I’ve also been checking if the animation is even playing.

Animator:GetPlayingAnimationTracks()

But nothing is popping up, if anyone knows how to play animation on a skinned mesh like mine, let me know. Let me also send it’s model children/descendants to see if I did any placements wrong.

image

Did you set your animation’s priority to Action?

Yes, even without it it should still play the animation as there are no other animations overriding it.

Did you try it from a local script?

Yes, I have tried it from both server and local script, I’m currently experimenting with many different things to see if I can get it just right to play the animation.

Not sure what’s happening. Maybe print out LoadedAnimation.IsPlaying?

Ok I somehow fixed it, it is working. I fixed it by removing the AnimationController, adding a normal script, and inside the script creating a new animation object with

Instance.new("Animation")

Then adding my AnimationId to it

local animationId = "rbxassetid://9176507064" -- change this to your animation id
local animation = Instance.new("Animation")
animation.AnimationId = animationId
local hum = script.Parent.Humanoid
local animator = hum.Animator
local animationTrack = animator:LoadAnimation(animation)

-- call this function to play the animation
animationTrack:Play()

I’m not sure if this has anything to do with the Animation object or if Skinned Meshes can’t play animations through an animation object. But weird feature, and I honestly dislike my life at this point.

3 Likes

Pretty sure I was gonna be the one to say that.

Haha, jokes aside, glad you fixed it!

YOU’RE A MASSIVE LIFE SAVER! LOOOOOOOOL
thank you so much!!