Cant stop a animations

I have a line of code to stop a looping animation, but not even the first print wont work,

		coroutine.wrap(function()
			print("hi")
			for _, track in pairs (HUmanoid.Animator:GetPlayingAnimationTracks()) do
				if track.Name == "Idle" then
					track:Stop()
				end
			end
		end)
	```
1 Like

um maybe its the HUmanoid part.

Its supposed to be like that, I accidentally spelled it like HUmanoid when making the local varibale

coroutine.wrap() returns a function value wrapped around a coroutine, you need to call that function.

coroutine.wrap(function()
	print("Hello world!")
end)()
local routine = coroutine.wrap(function()
	print("Hello world!")
end)

routine()
1 Like

That’s what I did in the first example I provided.

Here’s another.

local routine = coroutine.wrap(print)
routine("Hello world!")

maybe add a () at the end of the function so you actually call it

like this

coroutine.wrap(function)
    print("noob")
end)()