Mesh deformation animation script not working

Hi,

I’m trying to play an animation for my custom character but it doesn’t work.

Code
local Players = game:GetService("Players")

local player = Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hmn = char:WaitForChild("Humanoid")
local animator = hmn:WaitForChild("Animator")

local idleAnim = Instance.new("Animation")
idleAnim.AnimationId = "rbxassetid://6511649064"
idleAnim.Name = "Idle"
local idleAnimTrack = animator:LoadAnimation(idleAnim)
idleAnimTrack:Play()

The animation is being played on a mesh of bones and one motor6 attaching the humanoidRootPart to the model. No other animations are being played. The animation being played has loop = true and an animation priority = idle. The script does run all the way through.


Some things I’ve already tried:

  • Playing animation on humanoid instead of Animator.
  • Parenting the animation to the character before playing it.
  • Changing the animation priority to action.
2 Likes

Do you own the animation? If you don’t own the animation it will not play

1 Like

yes, I made the animation. blah blah blah… E0 char

Are any of the parts anchored?

1 Like

No, none of the parts are anchored.

Are you a team create place. Does it work if you publish the game and play it on roblox

1 Like

No team create place, and it doesn’t work playing on roblox.

Does it work in the animation editor

1 Like

yes, it works in animation editor

Do you change the name of any of the parts while running the game. Also what differences are their from the studio environment from the running environment

1 Like

there are blue dots where the bones start at when editing, are those supposed to move along when you move a joint?

No, there is only two parts, the humanoidRootPart and the model being manipulated. What do you mean “what differences are their from the studio environment from the running environment”. The model has a defualt t-pose in studio and when running. Everything works normal except the anim doesn’t play.

for example if the model is anchored while not running but unanchored while running the game that might cause something to happen that makes it work in the animation editor but not while running the game

Yeah, nothing is changing. That script is the only script running besides the default. The character is able to walk and jump around normally.

Image/Video of the issue/model?

Character walking around in game
https://gyazo.com/d45ebf699822dbd23021e3676d47293a
character in studio:
inGame
character when game running:
InStudio
While animation editing

Hope that helps

I found out the reason why it wasn’t playing the animation. When importing the character with mesh deformation is automatically comes with AnimationController which has a child of Animator. When I made it a custom character I added another Animator that was a decendent of the Humanoid which I believe was contradicting the first animator. All I did was delete the the AnimationController that came by default and it worked.

8 Likes

oh my god i tried removing it and it worked on mine too! thank you so much :smiley:

2 Likes

Can confirm this works. I’ve ran into this issue several times, glad this is such an easy solve.