Hello there!, im trying to make my own kick gui so whenever the player presses leave it will take them straight out of the game without the kick message.
I found a function called game:Shutdown() but when i used it. It said current identity 3 permission whatever. Yes i know it has to be written in a core script but could possibly get admin permission to do this?
You can just kick all of the players from the game to “Shutdown” the game. Then just kick anyone who tries to join too, to make sure it closes.
local PlayersService = game:GetService("Players")
local Players = PlayersService:GetPlayers()
for _, Player in pairs(Players) do
Any lua code you run is contained within the Roblox client, so I don’t think you can close the window from a local script. You can only kick the player, and they would still have to manually close out of the window themselves. If you don’t want a “You were kicked.” message to appear to the player then just call :Destroy() on the player object. It will disable the player however they will still see the map until they exit the window or the server shuts down.
As everyone else said, the only viable solution would probably to kick everyone out. Unfortunately, it will still display the kick message, though there is a parameter that allows you to add message with it.
Essentially you just want to loop through all the players and just kick them out one by one.
for i,Player in pairs(game:GetService("Players"):GetPlayers()) do
Player:Kick("This server has been shutdown by an administrator.")