
Apparently, the strings
Code: Select all
local d = findEntity("restDoor"..restCount)
if d then d:close() end
Code: Select all
findEntity("restDoor"..restCount):close()
In this way, thought you have to add an if statement on the top of the script to prevent the code looking for a non-existent entity (with a crash as a result), such as
Code: Select all
if restCount >= 6 then
return true
end
Let us know!

EDIT: forgot an equal

EDIT2: I don't know what I did the first time, but now Komag's code working right for me (and I hoped, because I could't see any flaws, I was a bit confused when it didn't work)
So try with the print
