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

why am i not getting whitelisted using a table?

Asked by 4 years ago
local whitelist = {"world_kiIIer","Femme_Devil"}
while wait() do
    for i,v in pairs(whitelist) do
    if #gui:GetChildren() > 4 and player.Name ~= v then
        game.Players.LocalPlayer:Kick("dont cheat")
    end
    if #rank:GetChildren() > 11 and player.Name ~= v then
        player:Kick("dont cheat")
        end
    end
end

i still get kicked when i got more than allowed (world_kiIIer) is the account i work with in studio

1 answer

Log in to vote
2
Answered by
Elixcore 1337 Moderation Voter
4 years ago
Edited 4 years ago

Please use a dictionary and access its index for stuff like this. your script kicks you because in one of the iterations, a conditional returns false on the whitelist part.

local player = game.Players.LocalPlayer
local whitelist = {
    ['world_kiIIer'] = true,
    ['Femme_Devil'] = true
}

while wait() do
    if not whitelist[player.Name] then 
         if #rank:GetChildren() > 11 or #gui:GetChildren() > 4 then
                player:Kick("Don't cheat.")
        end
    end
end
0
i dont get why this works and mine doesnt really but this works Gameplayer365247v2 1055 — 4y
0
I explained it to you above, in one of the iterations, the conditional statement returns false, in here there is no for loop, only 1 iteration that checks if the player is part of the dictionary, so it works. Elixcore 1337 — 4y
0
In your script, it returns true, goes to the next and kicks you, or the other way around, straight up kicking you. Elixcore 1337 — 4y
Ad

Answer this question