- What do you want to achieve? Keep it simple and clear!
I want the game to kick everybody from the server when an admin clicks the shutdown button.
- What is the issue? Include screenshots / videos if possible!
The issue is that only the admin gets kicked and not all the players.
Code
local frame = script.Parent.Parent.ShutdownFrame
local button = script.Parent
button.MouseButton1Click:Connect(function()
game.Players.LocalPlayer.PlayerGui.AdminPanel.Frame.ShutdownFrame.Visible = true
end)
frame.Shutdown.MouseButton1Click:connect(function()
for _, players in pairs(game.Players:GetPlayers()) do
game.ReplicatedStorage.ShutdownGUI:FireServer()
wait(10)
players:Kick(frame.Reason.Text)
end
end)
Local script inside shutdown button.