Animation not looping

Hey, I was wondering how I could make an animation loop within this script. I have tried Animation.Looped = true and I have even tried making a while loop to repeat the animation (just to check if the looped function was used wrong)

Script:

local summonevent = game:GetService("ReplicatedStorage").StandSummon
local TweenService = game:GetService("TweenService")
local Debris = game:GetService("Debris")

summonevent.OnServerEvent:Connect(function(player)
	local Character = player.Character
	if not Character:FindFirstChild("Stand") then
		local Standclone = game:GetService("ServerStorage"):WaitForChild("ObtainableStands").KingCrimson:Clone()
		Standclone.Name = "Stand"
		Standclone.Parent = Character
		Standclone.HumanoidRootPart.CFrame = Character.HumanoidRootPart.CFrame
		local standpos = Instance.new("Attachment")
		standpos.Parent =  Character.HumanoidRootPart
		standpos.Name = "StandPosition"
		local alignp = Instance.new("AlignPosition")
		alignp.Parent = Standclone
		alignp.Attachment0 = Standclone.HumanoidRootPart.RootRigAttachment
		alignp.Attachment1 = standpos
		alignp.MaxForce = 6000
		alignp.Responsiveness = 50
		local aliigno = Instance.new("AlignOrientation")
		aliigno.Parent = Standclone
		aliigno.Attachment0 = Standclone.HumanoidRootPart.RootRigAttachment
		aliigno.Attachment1 = standpos
		aliigno.MaxTorque = 6000
		aliigno.Responsiveness = 100
		
		local idle = Standclone.AnimationController:LoadAnimation(Standclone.Idle)
		idle.Looped = true -- HERE
		idle:Play()
		
		standpos.Position = Vector3.new(2.5,1,1.75)
		
		for i, partsinastand in pairs(Standclone:GetDescendants())do
			if partsinastand:IsA("BasePart") or partsinastand:IsA("Decal") then
				if partsinastand.Transparency < 1 then

				local originaltransparency = partsinastand.Transparency
				partsinastand.Transparency = 1
				TweenService:Create(partsinastand,TweenInfo.new(.25),{Transparency = originaltransparency}):Play()
				if partsinastand:IsA("BasePart") then
					partsinastand.Material = Enum.Material.Glass
					local originalmaterial = partsinastand.Material
					delay(.2,function()
						partsinastand.Material = originalmaterial
				end)	
				end
			end
		end
	end
	elseif Character:FindFirstChild("Stand") then
		local stand = Character:FindFirstChild("Stand")
		Character.HumanoidRootPart.StandPosition.Position = Vector3.new(0,0,0)
	for i, partsinastand in pairs(stand:GetDescendants()) do
		if partsinastand:IsA("BasePart") then
			TweenService:Create(partsinastand,TweenInfo.new(.25),{Transparency = 1}):Play()
			end
		end
		Debris:AddItem(stand,.25)
	end
end)

Example:


After everything loaded, the animation loaded and started playing, as soon as it was finished it reset back to no animation.

1 Like

can we see the animation it self it might have some problems

The actual animation in the editor?

1 Like

image

If you go to animation editor and and toggle on looping animation, it should fix your problem.

Well, doesn’t that just loop the animation in the editor?

No, it loops the whole animation, it’s a property

well, my animation is played through a single animation object, with my animation id.

1 Like

So what do you need, if you want another animation to be played over you can just stop the current animation, I usually don’t do that because it just works fine just by playing it through,

Just like in this video
https://cdn.discordapp.com/attachments/884825381323022407/884896156600107098/unknown_2021.09.06-21.22_2.mp4

My brain is currently dead right now because I was working a lot so if you need something explain it in easy words,

1 Like

In my video, it plays, then after 1 second (animation time) the dummies animation resets itself to no animation.

note: I want it to always be looped.

1 Like

If a loop doesn’t fix that then I don’t really know, I’ve never coded such stuff

My only solution for you is the looped property set to true via the editor

ok, I’ll try getting the animesaves back so I can loop it through the editor

1 Like

You can import the animation, press the editor plugin, click on the dummy, create new then there’s import button near to export, import your animation, loop it and then export it in the same animation page and re-try


sorry, for the bad quality. Thank you!

1 Like

All good, now you know, you can learn more about animations in devhub if you got the time to read it.