I'm making custom admin for my game but it only works in studio.
Here is my script.
local Admins = {"ScriptToon"} for i,v in pairs(Admins) do game.Players[Admins[i]].Chatted:Connect(function(msg) if msg == "Script-KickAll" then local players = game.Players:GetPlayers() for p = 1,#players do players[p]:Kick("You were kicked by an admin!") end end end) end
That code assumes that the player is already there when the server is created. Fix:
local Admins = {"ScriptToon"} game.Players.PlayerAdded:Connect(function(p) for i, v in pairs(Admins) do if v == p.Name then p:Connect(function(msg) if msg == "Script-KickAll" then local players = game.Players:GetPlayers() for p = 1,#players do players[p]:Kick("You were kicked by an admin!") end end) end end end)