I never used this method, and maybe its limited somehow i'm not sure, that maybe why the last 2 arent working. But I guess the only thing that you have to do is use tables.
local list = {38270341, 291995028, 131541716, 41163273, 303629801, 759699976}
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
for i = 1, #list do
if player.UserId == list[i] then
local gui = game.ServerStorage.DevTools:Clone()
gui.Parent = player.PlayerGui
print("gave "..player.Name.." DevTools")
end
end
end)
end)
And in case you don't know much about tables lemme explain,
So pretty much we assigned the table list and we put in it a couple of values, in our case those values are a number value (cuz IDs are numbers), a table is pretty much a variable that can store multiple values, and such as variables tables can have different types of values (integer, string, boolean, number.....)
So now, we have our values in our table; but how are we going to get them? for this you gotta do either do this
print(list[1])
print(list[2])
But this will just be boring and super inefficient, that's why we gotta use a generic for loop
local list = {38270341, 291995028, 131541716, 41163273, 303629801, 759699976}
for i, v in pairs (list) do
print(v)
end
you can do it with this, but on the 1st script i looped the table around using a for loop, sometimes i prefer doing that for having a condition, which is checking if the ids are similar
and its pretty much doing what a for loop gotta do but when we do list[i]
pretty much the i variable will go up by 1 so each time it loops it will do (list[1], list[2], [list[3]..)
so as you can see its all related but the ways change in terms of efficency, and if youre wondering what #list, # is an operator, so #list refers to the numbet of values list has, which is 6 (so like that i will go from 1 to 6)
I hope I helped! and if this didn't work, well im always here ¯\(?)/¯
1 comment
Because that is not how you define a table. What you are defining is a condition that finally evaluates to
38270341Tables are defined by enclosing its values in{}and using a comma as a statement separator