Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

how do you modify every value in an array simultaneously?

hello thanks for reading I was wondering if it was possible to modify a numbervalue in all of my parts in the array, for instance:

t = {game.mapstorage.map1:GetChildren()}

all of the children of map1 has numbervalues, is it possible to use

while true do --simultaneously change the value of the numbervalue in all of children wait(5) end

or simply put, how do i represent every single part in an array with one variable that i can play with?

thanks!

1 answer

✓ Accepted answer

First of all, don't wrap GetChildren in a table. It already returns a table.

local t = game.mapstorage.map1:GetChildren()

for num,obj in ipairs(t) do
    print(obj.NumberValue.Value)
end

This is as instant as it gets.

1 comment

0

Thanks so much for helping, I was really confused with the pairs, this helped clear it up.

This discussion is preserved as it was. New answers, comments, and votes are closed.