local List = {'Player', 'UltraUnitMode'} game.Players.PlayerAdded:connect(function(plr) if plr.Name == List then return true elseif plr.Name ~= List then plr:Destroy() end end)
You need to loop through the table using a for loop.
Code:
game.Players.PlayerAdded:connect(function(plr) local success = false for i,v in pairs(List) do if v == plr.Name then success = true end end if not success then plr:Destroy() end end)
List
is literally a list. How could your name ever equal a list? That makes no sense.
What you want to do is find if your name is inside the list.
We could use a for loop to compare each item to your name, writing a function like this:
function isInList(name) for i, v in pairs(List) do if name == v then return true end end end
But an easier method would be to make use of dictionaries;
local List = { ["Player"] = true, ["UltraUnitMode"] = true } game.Players.PlayerAdded:connect(function(plr) if not List[plr.Name] then --if you're not in the list plr:Kick() --use kick() instead of destroy() end end)