Clorp
Clorp

Reputation: 11

Roblox Studio Animation Not Playing

So, I want to do the simple task of playing an animation on the player when you spawn in the game. I'm confused as to why it's not playing, because I ripped the script directly from Roblox documentation (except that I added my own animation).

local Players = game:GetService("Players")

local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()

-- Ensure that the character's humanoid contains an "Animator" object
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")

-- Create a new "Animation" instance and assign an animation asset ID
local myAnimation = Instance.new("Animation")
myAnimation.AnimationId = "rbxassetid://88287635939752"

-- Load the animation onto the animator
local myAnimationTrack = animator:LoadAnimation(myAnimation)

-- Play the animation track
myAnimationTrack:Play()

This is a local script in StartPlayerScripts

I tested the animation itself, and it works perfectly fine on dummies with humanoids. I've printed the classes and names off all the variables and they all return what they're supposed to. Where could the problem be?

Upvotes: 0

Views: 383

Answers (1)

Chris van Chip
Chris van Chip

Reputation: 698

There are multiple causes why animations may not seem playing:

  1. Ensure your character is in the same rig as the animation. R6 animations don't work on R15, and vice versa.
  2. Add a task.wait(5) on top of your script and playtest again. If you have a short animation, it could be that the animation played while the playtest was booting up.
  3. Ensure the animation is uploaded by the creator of the game / uploaded to the same group. You may want to check Output for any loading errors.

Upvotes: 1

Related Questions