Inside my BindToClose() function, I have this:
game:BindToClose(function()
print("BindToClose Function For Leaderboard Runs Now!")
if not RunService:IsStudio() then
print("Player not detected in studio")
for _, player in pairs(game.Players:GetPlayers()) do -- notice that you can loop through every player left in the server so the function can run for them
print(player)
player:Kick("Server is shutting down. Please rejoin, your game data will be saved.") -- WHY DOESN'T THE PLAYER GET KICKED. I DON'T SEE THIS MESSAGE.
print("Message sent to player for being kicked!")
end
while true do
wait()
end
else
wait(5)
end
end)
And this is the script for the skips:
game:BindToClose(function()
print("BindToClose Function For Skips Runs Now!")
if not RunService:IsStudio() then
print("Player not detected in studio")
for _, player in pairs(game.Players:GetPlayers()) do -- notice that you can loop through every player left in the server so the function can run for them
print(player)
player:Kick("Server is shutting down. Please rejoin, your game data will be saved.") -- WHY DOESN'T THE PLAYER GET KICKED. I DON'T SEE THIS MESSAGE.
print("Message sent to player for being kicked!")
end
while true do
wait()
end
else
wait(5)
end
end)
Why don't the player's get kicked? I tested this is roblox server and the console prints the player but not the actual kicking part.

2 comments
Is there any way to change the delay of server shutdown for maybe just 5 seconds? If not, then is there any way to kick the player when the server shutdowns (not in the delay time). As soon as we click on shutdown all servers?
Well, the problem is when you click on server shutdown, the server shutdowns immediately and due to BindToClose, it can be delayed for the maximum of 30 seconds. The problem, here, is all the client scripts stop working on server shutdown and it becomes nearly impossible to kick players.