I don’t have any extra info for this bug. ( read the linked topics )
But a possible solution is to add a settings option that users can toggle if they want to wait until BindToClose finishes.
Code
local seconds = 30
local waited = 0
local interavels = 0.5
game:BindToClose(function()
while task.wait(interavels) do -- you can replace all of this with task.wait(30)
warn(waited)
waited += interavels
if waited >= seconds then break end
end
end)
The other posts you linked all seem like different bugs. None of them were actually yielding for 30 seconds or more, but your code is. I think this is an intended behaviour of :BindToClose because it is literally waiting for 30 seconds like you wrote the code to do before allowing the playtest server to shutdown.
oh sorry, mb.
Ty for telling me.
Tbh I made this post with an assumption that someone else has already reported this bug (because I noticed it a year or 2 ago), and just searched the error message.
Yeah it’s intended behaviour in a “live” server, but in Studio it should [spoiler]imo[/spoiler] either run the BindToClose in the background, or ask the user if they want to wait.
… or at least let us know that this can happen in the docs, because I had a hard time tracking the problem.
Hanging the whole studio and freezing all inputs without a message indicating that it’s loading/closing the server made me think it was a bug, because that’s very similar to crashing [spoiler]( I’ll wait for a staff member to let me know if it’s not )[/spoiler]
+I used task.wait(30) as an easy way to simulate a heavy task, or a few yieldable apis/functions.