is there anyway to use a table to check a players name like this:
local players = {"paper", "someone", "aLightBulb"} game.Players.PlayerAdded:Connect(function(player) if player.Name == players then print("yes") end end)
but that wouldnt work, is there anyway to do this using a table like an array or something
Iteration of an array is very easy:
local players = {"paper", "someone", "aLightBulb"} for _, player in pairs(players) do print(player) -- prints out "paper", "someone", "aLightBulb" end
Now you merely check if the player name matches any of the table's values:
local players = {"paper", "someone", "aLightBulb", "Vulkarin"} game.Players.PlayerAdded:Connect(function(player) local found = false for _, storedPlayer in pairs(players) do if player.Name == storedPlayer then print("yes") found = true break end end if not found then print("no") return end end)