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

inserting a lot of data in an array?

hello thanks for lending me your time, I was wondering if it was possible to insert a whole segment of an array into another one given a certain condition. I can't figure out why this isnt working:

local parts = map:GetChildren()
local mapparts = {}

for _, p in ipairs (parts) do
	if p.Name == "mappiece" then
	table.insert (mapparts, p)
	end
end

i dont know why it only inserts 1 value into the table 'mapparts', could anyone help me out? thanks! (table parts has a lot of parts named mappiece)

1 answer

ok sorry im stupid, i did it wrong, but anyways, if anyone would like to know how i did it for future reference;

local parts = map:GetChildren()
local mapparts = {}

function sorter(part)
		if part.Name == "mappiece" then
			table.insert(mapparts,part)
		end
	end
		
for _, wotowot in ipairs (parts) do
	sorter(wotowot)
end

1 comment

0

close the question please

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