Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why my Animation loop script doesn't work?There are two animations byt he way.

So this is the script that doesn't work.There are two different animations in it by the way.

local animation1 = game.Workspace.e.Script.Animation1 local HitmanAnimation1 = script.Parent:WaitForChild("Humanoid") local LoadingHitmanAnimation1 = HitmanAnimation1:LoadAnimation(animation1)

local animation2 = game.Workspace.e.Script.Animation2 local HitmanAnimation2 = script.Parent:WaitForChild("Humanoid") local LoadingHitmanAnimation2 = HitmanAnimation2:LoadAnimation2(animation2)

while true do LoadingHitmanAnimation1:Play() LoadingHitmanAnimation1:Stop() wait(0.1) LoadingHitmanAnimation2:Play() LoadingHitmanAnimation2:Stop() end

3 comments

0

Please put the script in the Lua Code Block, it will be helpful.

0

Oh

0

By any chance you're using a R6 animation on a R15 character or a R15 animation on a R6 character?

1 answer

✓ Accepted answer
local animation1 = script:WaitForChild("Animation1") 
local HitmanAnimation1 = script.Parent:WaitForChild("Humanoid") 
local LoadingHitmanAnimation1 = HitmanAnimation1:LoadAnimation(animation1)

local animation2 = script:WaitForChild("Animation2") 
local HitmanAnimation2 = script.Parent:WaitForChild("Humanoid") 
local LoadingHitmanAnimation2 = HitmanAnimation2:LoadAnimation2(animation2)

--  while true do 
--	LoadingHitmanAnimation1:Play() 
--	LoadingHitmanAnimation1:Stop() 

--	wait(0.1) 
	
--	LoadingHitmanAnimation2:Play() 
--	LoadingHitmanAnimation2:Stop() 
-- end 

-- Here, it looks like you are starting your animation and then stopping it. To fix that, you can try the replacement code

while true do
	LoadingHitmanAnimation1:Play()
	LoadingHitmanAnimation1.Stopped:wait() -- It will wait for the animation to complete

	wait(0.1)

	LoadingHitmanAnimation2:Play()
	LoadingHitmanAnimation2.Stopped:wait()
end

Lemme know if it helps!

7 comments

0

For some reason it doesn't work and it is not because you said local animation1 = script:WaitForChild("Animation") instead of local animation1 = script:WaitForChild("Animation1")

0

Is the animation working without a loop?

0

It just doesn't work.

0

I might know the problem.If used MoonAnimator to put him in a pose and then the HumanoidPart was somewhere else.Does that makes it not work?

0

NVM I FOUND THE PROBLEM NOW LET ME SEE IF IT WORKS!

0

Also your script does work! I just had a bugg.....

0

Glad to hear that!

This discussion is preserved as it was. New answers, comments, and votes are closed.