Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
4

Is there a way to make a player's game shut down?

Asked by 10 years ago

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?

0
If the method ":Kick()" doesn't suffice, you can try and create a GUI that blocks the screen for that player, then kick 'em. Redbullusa 1580 — 10y
0
@Red Okay thanks EzraNehemiah_TF2 3552 — 10y
0
I changed my answer, thank you for pointing that out. MessorAdmin 598 — 10y

3 answers

Log in to vote
1
Answered by 10 years ago
01-- Server side...
02local PlayersTable = {'Player1','Player2'}
03 
04function Disconnect(Plr)
05    for _,v in pairs(PlayersTable) do
06        if v == Plr  then
07            v:Kick()
08        end
09    end
10end
11 
12--Example :
13 
14Disconnect("Player1")
15 
View all 53 lines...
0
I know it's been like days but there is a bug in your script. EzraNehemiah_TF2 3552 — 10y
0
Lol, I see it.. Thanks for pointing that out. I will fix it. MessorAdmin 598 — 10y
0
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 EzraNehemiah_TF2 3552 — 6y
Ad
Log in to vote
0
Answered by
Vrakos 109
10 years ago

Try this:

01local Shutdown = false;
02 
03--// Shutdown server
04for _,Player in pairs(game.Players:GetPlayers()) do
05    Player:Kick()
06    Shutdown = true
07end
08 
09--// Prevent new players joining
10game.Players.PlayerAdded:connect(function(Plr)
11    if Shutdown then
12        Plr:Kick()
13    end
14end)
0
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? EzraNehemiah_TF2 3552 — 10y
0
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.) MessorAdmin 598 — 10y
Log in to vote
0
Answered by
Lacryma 548 Moderation Voter
10 years ago

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.

01banned = {"Noob", "AnnoyingGuest"}
02 
03function isBanned(name)
04    for i,v in pairs(banned) do
05        if v:lower() == name:lower() then
06            return true
07        end
08    end
09    return false
10end
11 
12game.Players.PlayerAdded:connect(function(plr)
13    if isBanned(plr.Name) then plr:Kick() end
14end)
0
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. EzraNehemiah_TF2 3552 — 10y

Answer this question