hey, all im trying to achieve is a dictionary that has the entries of the material of the brick, and the corresponding color. but it is giving me strange outputs! I have added a few other prints to just check the values are correct - but they are and still, the table is giving me weird output!
heres the final variation of code i thought should work
local collection = game:GetService("CollectionService")
local tagged = collection:GetTagged("cool")
local list = {}
for _, tagged in pairs(tagged) do
local material = tagged.Material
local color = tagged.BrickColor
print(material,color)
list[material] = color
end
print(list)
ok, this seemed to work, but why does it work but not the first version?
local collection = game:GetService("CollectionService")
local tagged = collection:GetTagged("cool")
local list = {}
local x = {}
local y = {}
for _, tagged in pairs(tagged) do
table.insert(x,tostring(tagged.BrickColor))
table.insert(y,tagged.Material)
end
for dummy = 1,#x , 1 do
list[x[dummy]] = y[dummy]
end
print(list)