I have a while loop in a coroutine and every time I resume the coroutine I get the error :
“08:05:31.601 Workspace.Lab1.bringWaterButton.bringWater:40: invalid argument #1 to ‘resume’ (thread expected, got table) - Server - bringWater:40”
Here is my Script :
local takeDamage = coroutine.create(function()
while true do
wait(.05)
local partsInRegion = game.Workspace:findPartsInRegion3(region,regionPart,100)
for i,v in pairs(partsInRegion) do
if v:FindFirstChild("Humanoid") then
v.Humanoid.Health -= 1
end
end
end
end)
coroutine:resume(takeDamage)
I got this method off a very old video , I tried to find a new method but couldn’t , if there is one or I am simply doing this wrong , please tell me.