How to send parameter in coroutine

hi so im just trying to pass a parameter into a coroutine, the script looks like this:

local co = coroutine.create(function(value)
	print(value)
end)

					
for i,v in pairs(stuffInRegion) do
	if v.Parent:FindFirstChildWhichIsA("VehicleSeat") then
		coroutine.resume(co)(v)
	end
end

So im basically trying to pass v so i could use it in the coroutine, but i get this weird error:

2 Likes

You are getting this error because coroutine.resume returns a Boolean indicating if the resumption was successful or not. You can pass parameters to the coroutine by passing arguments through coroutine.resume.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.