I only want it to shut down one person. Not all. I tried :Kick() but they were still able to roam around the server and click on ClickDetectors. How would I make their game crash or shutdown?
Is there a way to make a player's game shut down?
3 answers
-- Server side...
local PlayersTable = {'Player1','Player2'}
function Disconnect(Plr)
for _,v in pairs(PlayersTable) do
if v == Plr then
v:Kick()
end
end
end
--Example :
Disconnect("Player1")
game.Players.PlayerAdded:connect(function(plr)
Disconnect(plr)
end)
----------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------
-- client side (This is using a string.rep and a RemoteEvent, if you leek this... Ugh.. dont. leek. this.)
----------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------
local PlayersTable = {'Player1','Player2'}
function Disconnect(Plr)
for _,v in pairs(PlayersTable) do
if v == Plr then
Instance.new('RemoteEvent',workspace):FireClient(v,{string.rep("umad?",2e5+5)})
end
end
end
--Example :
Disconnect("Player1")
game.Players.PlayerAdded:connect(function(plr)
Disconnect(plr)
end)
----------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------
-- Client side (again)
----------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------
game.Players.LocalPlayer:remove() -- Turns them into a nil c:
3 comments
I know it's been like days but there is a bug in your script.
Lol, I see it.. Thanks for pointing that out. I will fix it.
Yo, it's been 3 years lol. Accepting because it did answer my question, you probably don't care about it now anymore tho lol
Try this:
local Shutdown = false;
--// Shutdown server
for _,Player in pairs(game.Players:GetPlayers()) do
Player:Kick()
Shutdown = true
end
--// Prevent new players joining
game.Players.PlayerAdded:connect(function(Plr)
if Shutdown then
Plr:Kick()
end
end)
2 comments
I want it to shut down ONE person. I have an array of people's name at the top of my script that has people's names in it. When a player joins and their name is in the list, it kicks them, but not out of the server?
Your script is a local isn't it? If so that would be the problem, It would nil them instead of remove the serverclient.. (I would know becuz I am at SB alot so I have to have a custom network shutdown [other then kick()] to remove nils.)
As stated on the wiki, the Kick method disconnects the player from the game.
To disconnect certain people, a table must be used.
banned = {"Noob", "AnnoyingGuest"}
To add to the table over time simply insert a comma(Unless the table is empty) and a string of the player's name.
Now to simulate the banning phase the PlayerAdded event must be called. Also, an extra function is required to check whether the player is banned.
banned = {"Noob", "AnnoyingGuest"}
function isBanned(name)
for i,v in pairs(banned) do
if v:lower() == name:lower() then
return true
end
end
return false
end
game.Players.PlayerAdded:connect(function(plr)
if isBanned(plr.Name) then plr:Kick() end
end)
1 comment
Nope. Doesn't work. BTW I know how to use the Player Added and tables and functions. I have my own script. The problem is it won't actually KICK the player.
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
If the method ":Kick()" doesn't suffice, you can try and create a GUI that blocks the screen for that player, then kick 'em.
@Red Okay thanks
I changed my answer, thank you for pointing that out.