Hi, I am trying to make it so that if the game is in debug mode, the usernames that are in the table can join. It seems to be kicking everyone. Here is my code:
local debug = true
local DebugAdmittedUsers = {"WooleyWool", "MysticalLuma"}
if debug == true then
for i = 1, #DebugAdmittedUsers, 1 do
if player.Name == DebugAdmittedUsers[i] then
--User is allowed
else
player:Kick("The game is currently in Debug mode. Only those who are a part of the Debug team can join. Please come back later.")
end
end
end
local DebugAdmittedUsers = {"WooleyWool", "MysticalLuma"}
function isInTable(tableValue, toFind)
local found = false
for _,v in pairs(tableValue) do
if v == toFind then
found = true
break
end
end
return found
end
if debug then
if isInTable(DebugAdmittedUsers, player.Name) then
-- allowed
else
player:Kick()
end
end
Another solution would be to just use the names as indexes so you can do this:
local allowed = {
['WooleyWool'] = true;
['MysticalLuma'] = true;
}
if debug then
if not allowed[player.Name] then --Check if they aren't in the table, or you can set a name to false so they're specifically black listed.
player:Kick()
end
end