How To Make This Script Repeat 10 Times?

local animation = Instance.new(“Animation”)
animation.AnimationId = “rbxassetid://8860557650”

local trackanimation = nil
local playability = true

function playAnimation (animationSource)
if playability == true then
local plr = game.Players.LocalPlayer
trackanimation = plr.Character.Humanoid:LoadAnimation(animation)

	trackanimation.KeyframeReached:Connect(function()
		print("Animation successfully played!")
	end)
	trackanimation:Play()
end

end
script.Parent.MouseButton1Click:Connect(playAnimation)

You can use a for loop that uses a range from 1-10.

1 Like