I scripted a door handler with an option to open and close every door on the server at once, it used to work perfectly fine, but for some reason the coroutine function I used is no longer working. Any idea?
This is the code
function InteractAll(_,plr,action)
if Perms(plr) then
for _,a in pairs(workspace.Doors:GetChildren()) do
for _,v in pairs(a:GetChildren()) do
print("Working 1")
coroutine.wrap(function()
print("Working 2") -- Not working from here
if action == "open" then
if v.Values.Busy.Value == false then
if v.Values.Open.Value == false then
v.Values.Busy.Value = true
OpenDoor:FireAllClients(v)
wait(1.5)
v.Values.Open.Value = true
v.Values.Busy.Value = false
end
end
elseif action == "close" then
if v.Values.Busy.Value == false then
if v.Values.Open.Value == true then
v.Values.Busy.Value = true
OpenDoor:FireAllClients(v)
wait(1.5)
v.Values.Open.Value = false
v.Values.Busy.Value = false
end
end
end
end)
end
end
end
end
working - YouTube - This is a video of the code working
not working - YouTube - Here it doesn’t