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

How to :GetChildren() from a Table?

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

✓ Accepted answer

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()

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