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.
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
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
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.