Animation Scripting Help

Hi! I am trying to work on a Cop Idle animation that plays while the UI Button is being clicked. I thought the script was fine and all, but I guess not. It says the animation failed to load each time I try. I do know the animation is real though.

^ Properties.

Currently, no errors besides that it fails to load.


local Emotes = script.Parent.Emotes
local CopIdle = script.Parent.CopIdle
local CopIdleAnimation = Emotes.CopIdle
local character = game.Players.LocalPlayer.Character
local humanoid = character.Humanoid


local animationTrack = humanoid:LoadAnimation(CopIdleAnimation)
animationTrack.Looped = true



local animationTrack = humanoid:LoadAnimation(CopIdleAnimation)
animationTrack.Looped = false


Could you send your current script?

Sorry! I forgot somehow. Let me edit

Are they your animations? roblox doesn’t allow us to use other people’s animations so if you didn’t make it you gotta make it yourself from scratch. Also why are you waiting 5 seconds at line 1? This is not good practice. If you need to wait for things use RBXScriptSignal:Wait() or Instance:WaitForChild to wait for events to fire and wait for an instance, respectively.

It’s possible that the stuff you’re waiting for has already loaded in before the 5 seconds have been finished, but your code is still waiting before it can declare the variables and establish the event listeners. The code should wait, and immediately when the things are loaded, wait for the next if necessary, and so on


Ah, okay. I was wondering if it was because they weren’t mine. Is there any possible way to use another persons animations? As if they were like, given to me through file or such?

I use wait(5) just for testing

I don’t know, but I’d recommend making it from scratch.