I’m making a script where I simply click a button, and the server shuts down, but it doesn’t work?
(if you are worried about exploiters, they cannot fire to all clients and the button only becomes visible with my userid)
Button Script
local Players = game:GetService("Players")
local LocalPlay = Players.BlueClothesPerson
local Button = script.Parent
Button.MouseButton1Click:Connect(function()
game.ReplicatedStorage.ShutAbility:FireAllClients()
end)
RemoteEvent
local Event = game.ReplicatedStorage.ShutAbility
Event.OnServerEvent:Connect(function(Caller)
if Caller.UserId == game.CreatorId then
for _, Player in pairs(game.Players:GetPlayers()) do
local m = Instance.new("Message")
m.Parent = game.Workspace
m.Text = "⚠ This server is going to close in 5 SECONDS ⚠"
wait(5)
Player:Kick("server shut down")
end
end
end)
If (somehow) you are able to make the TextButton
to be able to change the kick reason, that would be great!
(not needed though)