Animation Script Help

I can’t seem to find a way to play this. This is the right way for what I know.

The code:

-- local script in StarterCharacterScripts
while true do
	local Character = workspace.Dummy
	local Animator = Character.Humanoid.Animator
	local Anim1 = Animator.Anim1
	local Anim2 = Animator.Anim2
	local Anim3 = Animator.Anim3
	Animator:LoadAnimation(Anim1)
	Animator.AnimationPlayed:Wait()
	Animator:LoadAnimation(Anim2)
	Animator.AnimationPlayed:Wait()
	Animator:LoadAnimation(Anim3)
	Animator.AnimationPlayed:Wait()
	Anim1:Destroy()
	Anim2:Destroy()
	Anim3:Destroy()
end

What happens:

image

Here you destroy all three animations, i.e. after one loop animations do not exist in the character

1 Like

Also, instead of using an while true loop and loading animations into the animator each time, you can immediately load them into the animator and use.

You can also use the AnimationTrack’s Stopped event to start them one by one.

local someAnimator 
local someAnimation

local animationTrack = someAnimator:LoadAnimation(someAnimation)
animationTrack.Stopped:Connect(function()
--do something
end)

Still doesn’t work. (Charrrrrrrrrrrrrrrrrrrr)

Are you trying to animate a ‘Dummy’? since i do not really think you can animate a dummy thru a local script.

1 Like

Yes. It’s possible because it’s been done before, it’s like this:
image

Managed to get it to work once.
The new code:


local Character = workspace.Dummy

local Animator = Character.Humanoid.Animator

local Anim1 = Animator.Anim1

local Anim2 = Animator.Anim2

local Anim3 = Animator.Anim3


while true do
	local Anim1Animator = Animator:LoadAnimation(Anim1)
	Anim1Animator:Play()
	Animator.AnimationPlayed:Wait()
	local Anim2Animator = Animator:LoadAnimation(Anim2)
	Anim2Animator:Play()
	Animator.AnimationPlayed:Wait()
	local Anim3Animator = Animator:LoadAnimation(Anim3)
	Anim3Animator:Play()
	Animator.AnimationPlayed:Wait()
end

All it does is play once, then stops.

Is team create enabled? If enabled, then this may be the main problem.

1 Like

If team create is enabled, then in order for the animations to work, the owner of the place needs to upload animations on their behalf, and then use them in the game.
At the same time, only the owner will see animations in the studio, but everyone will see them in the place.

They are owned by a group. Ever animation is owned by a group, and the game is owned under the same group. Plus, the animations play, the issue is they don’t repeat.

Do animations work in the place, not in the studio? If so, then the problem is clearly elsewhere.
Could you upload the place file with animations and dummy?

DEVFORUMA1.rbxm (151.4 KB)

Sorry, I don’t understand what could be the problem, everything works fine in the file. :expressionless:
Maybe someone else can help you with this problem.
I’m sorry for wasting your time :pensive:

You only need to do Animator:LoadAnimation(animation) once, you can just do

local Anim1 = Animator.Anim1
Anim1 = Animator:LoadAnimation(Anim1)

and so on. To play it you just need to do (animation you want to play):Play()
I don’t think that will solve the problem but try that

1 Like