If I were to try and create a for loop that checks for the children of the contents of of a table, how would I do it? MY current idea is:
local 1 = game.Workspace.Part1 local 2 = game.Workspace.Part2 local 3 = game.Workspace.Part3 local table = {1,2,3} for _, v in pairs (#table:GetChildren()) if v:FindFirstChild("Value1") == true then v:Destroy() end end
Is this correct?
Variables have to start with a letter:
local p1 = game.Workspace.Part1 local p2 = game.Workspace.Part2 local p3 = game.Workspace.Part3
You can stack the parts straight into a table:
local tab = {Workspace.Part1,Workspace.Part2,Workspace.Part3}
Also, any word that shows up highlighted (blue) in ROBLOX.Lua, cannot (or shouldn't be) used as variables. It'll either causes errors or problems for you in the future.
Another thing, the method ":GetChildren()" can only be used on Instances, and returns a list of objects.
Since you've already made a table, you do not need to use the GetChildren() method. This will cause errors.