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 9 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 — 9y
0
@Red Okay thanks EzraNehemiah_TF2 3552 — 9y
0
I changed my answer, thank you for pointing that out. MessorAdmin 598 — 9y

3 answers

Log in to vote
1
Answered by 9 years ago
-- 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:

0
I know it's been like days but there is a bug in your script. EzraNehemiah_TF2 3552 — 9y
0
Lol, I see it.. Thanks for pointing that out. I will fix it. MessorAdmin 598 — 9y
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
9 years ago

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)
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 — 9y
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 — 9y
Log in to vote
0
Answered by
Lacryma 548 Moderation Voter
9 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.

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)
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 — 9y

Answer this question