Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

why am i not getting whitelisted using a table?

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

✓ Accepted answer

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

3 comments

0

i dont get why this works and mine doesnt really but this works

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.

0

In your script, it returns true, goes to the next and kicks you, or the other way around, straight up kicking you.

This discussion is preserved as it was. New answers, comments, and votes are closed.