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

PlayerAddedEarly event - how can I use it?

Asked by 9 years ago

If I were to code the following:

Allowed = {"XanthicDragon", "InsertNameHere"}
k = false

function KickRandomPlayer()
    local Players = game:GetService("Players").NumPlayers --Is that the variable? I may be wrong
    local random = math.random(1, Players)
    game.Players:GetChildren()[random]:Kick()
end

game:GetService("Players").PlayerAddedEarly:connect(function (Player)
    for _,v in ipairs(Allowed) do
        if Player.Name == v then
            k = true
        end
    end
    if k then
        KickRandomPlayer()
        k = false
    end
end)

Would this event fire and kick a random player if one of the players found in "Allowed" were attempting to join a full server?

2 answers

Log in to vote
1
Answered by 9 years ago

No it would not work, game.Players.PlayerAddedEarly is not a real function.

0
Appears to be protected though, so yeah. Though either way you meant EVENT, not FUNCTION. iaz3 190 — 9y
0
Yeah... xImmortalChaos 565 — 9y
Ad
Log in to vote
-1
Answered by
iaz3 190
9 years ago

No. While the event apparently exists, it also is apparently locked.

You will not be able to use it.

Answer this question