Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to :GetChildren() from a Table?

Asked by
Qorm 100
9 years ago
x=script.Parent
table1={script.Parent:GetChildren()}
button=script.Parent.button
debounce=true

button.Touched:connect(function(onTouch)
    if debounce==true then
        debounce=false
for i=1,10 do
for o,p in pairs(table1) do
    p.CFrame=CFrame.new(p.CFrame.x+1,p.CFrame.y,p.CFrame.z)
    wait(2)
    end end end
    debounce=true
end)

I want to make everything in the script's parent move, but when I do this, it says: Workspace.buildingright.Script:11: attempt to index field 'CFrame' (a nil value) I don't know what else to try.. Help would be appreciated

1 answer

Log in to vote
1
Answered by 9 years ago

The GetChildren method returns a table, so there is no reason to put it in another table. Replace line 2 with this:

table1 = script.Parent:GetChildren()
Ad

Answer this question