So i’m trying to use coroutine.wrap with a while true do to prevent it from yielding entire function, however it does not seem to loop nor print anything? Any ideas why?
if CHAINSAWON == true then
__LOOP:Play()
__ATTACK:Play()
coroutine.wrap(function()
while CHAINSAWON == true do -- does not print
print("STARTED ATTACKINGa")
task.wait(0.7)
__HITBOXREAL:HitStart()
task.wait(0.01)
__HITBOXREAL:HitStop()
if CHAINSAWON == false then
print("STOPPED ATTACKING")
break
end
end
end)
task.spawn(function()
if CHAINSAWON == true then
task.wait(3.7)
print("STOPPED ATTACKINGO SPAWN") -- this prints
__CANTATTACK = false
__HITBOXREAL:HitStop()
end
end)
end