Banner Notify | soft shut down

Hello, I’m trying to make a script that when I shut down all the servers like a soft shutdown it notifies the players and then kicks them or reconnect them using: Banner Notify | Best way To Notify!

My script | Chat GPT

local BannerNotification = require(game:GetService("ReplicatedStorage").BannerNotification_Storage.BannerNotificationModule)

-- Function to kick all players from the game
local function kickAllPlayers()
	for _, player in ipairs(game.Players:GetPlayers()) do
		player:Kick("You have been kicked from the server due to maintenance.")
	end
end

-- Function to display a notification and kick players
local function notifyAndKick()
	-- Notify players about the server shutdown
	local configs = {
		.3,                            -- Background Transparency
		Color3.fromRGB(255, 38, 0),       -- Background Color
		0,                             -- Content Transparency
		Color3.fromRGB(255, 255, 255), -- Content Color
	}
	BannerNotification:Notify("Red Alert", "Server shutting down in a few seconds!", "rbxassetid://14202377967", 5, configs)

	-- Kick players after a delay
	wait(5) -- You can adjust the delay as needed
	kickAllPlayers()
end

-- Replace the trigger function with your own logic
local function triggerShutdown()
	-- Add your custom logic here to trigger the shutdown,
	-- such as a RemoteEvent or another script function call.
	-- For example:
	game:GetService("TeleportService"):TeleportToPlaceInstance(game.PlaceId, game.JobId)
end

-- Call notifyAndKick function when you want to trigger the shutdown
triggerShutdown()

(script in server script service)


Thank you, so much.

Do you get any tips of errors?

Dead thread, he probably forgot about it or figured it out.

@DylanandMarley?

An update on your issue or closing the thread would be appreciated.