Animation starts but few second later it stops any sulution?

Hello, I have created an animation. However, if I play with character it plays for a few seconds and then it suddenly stops, If you run the game it does not stop animation and working perfectly. What should I do? (Sorry for low quality video I recorded on Roblox studio)

local animation = script:WaitForChild('Animation')
local humanoid = script.Parent:WaitForChild('Humanoid')
local dance = humanoid:LoadAnimation(animation)
dance:play()
dance.Looped = true

you can try:

local animation = script:WaitForChild('Animation')
local humanoid = script.Parent:WaitForChild('Humanoid')
local dance = humanoid:LoadAnimation(animation)
dance:Play()
dance.KeyframeReached:connect(function(keyframeName)
if keyframeName == "Pause" then
	dance:Stop()
task.wait(0.01)
dance:Play()
	end
end)