You probably have seen something like this before, essentially i'm trying to kick the players before the server shuts down. The problem is it doesnt kick the player, and it prints "???" when it should kick me BEFORE printing that. Anyone have any ideas why this wont work???
game:BindToClose(function() for i, player in ipairs(game.Players:GetChildren()) do player:Kick("The Game Is Shutting Down, Please Rejoin") end print("???") wait(5) end)
Note that you can only use this once in the game. Also, try this instead:
game:BindToClose(function() for _,v in pairs(game:GetService("Players"):GetPlayers()) do v:Kick("Game is shutting down...") end end)