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

What is wrong with this GetChildren function?

I'm new to GetChildren, this is my first time using it. The script I wrote does not work, and I'm not sure why.

function boom()
	local walkwaychildren = game.Workspace.Bridge.walkway:GetChildren()
	walkwaychildren.Anchored = false
end

script.Parent.ClickDetector.MouseClick:connect(boom)

Any help?

1 answer

✓ Accepted answer

The function GetChildren returns a table, so you have to loop through the table.

When you loop through it, you loop through every part or object inside the GetChildren object

Here is a script for what your trying to do:

local model = game.Workspace:WaitForChild("Bridge")--Change variable
for i,v in pairs(model:GetChildren()) do
	v.Anchored = false
end	

Glad to help, if this helps please accept this answer, it gives us both rep!

1 comment

0

Thanks!

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