No errors or anything, no clue whats wrong with this.
local owner = {game.CreatorId} -- add UserIds in this format 'game.CreatorId, 39493, 304034' etc.. local admin = {} -- add UserIds like above. local Int = Instance.new('IntValue') game.Players.PlayerAdded:connect(function(plr) for _,v in pairs(owner or admin) do if plr.UserId == v then print('hi') end end end)
Eh, here let's start over, your script doesn't seem correct but your on to something.
First let's setup the variables and the event.
local owner = {game.CreatorId} local admin = {} game.Players.PlayerAdded:connect(function(plr) end)
Next let's create a variable inside the event and then check through each id to see if the plr's id is in one of the tables
local owner = {game.CreatorId} local admin = {} game.Players.PlayerAdded:connect(function(plr) local isin = false for _,v in pairs(owner) do if v==plr.UserId then isin=true break end end if isin==false then for _,v in pairs(admin) do if v==plr.UserId then isin=true break end end end if isin==true then print("he's in") end end)
Expanding on Danz script; you can also use a dictionary array, which would allow you to check the table without running a for loop each time.
local admin = { ['azarth'] = {creator = true, id = 312625920}; ['danzlua'] = {creator = false, id = 12345}; } -- Note that CreatorId will be 0 in studio. local function player_joined(plr) local index = admin[plr.Name:lower()] if index then if index.id == plr.UserId then if index.creator then print( string.format("%s is the creator", plr.Name)) else print( string.format("%s is an admin", plr.Name)) end else print( string.format("%s is a(n) %s, but the UserId didn't match.", plr.Name, index.creator and 'creator' or 'admin')) end end end game.Players.PlayerAdded:Connect(function(plr) player_joined(plr) end) -- Catches the players that joined before PlayerAdded connected. for i,v in pairs(game.Players:GetPlayers()) do player_joined(v) end