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

How would I go about moving with :Children()?

wait(1)
script.Parent.Model.children().Parent = script.Parent

How would I move the children of the model to the model that the script's parent is?

4 answers

✓ Accepted answer

Ah, okay, so let me explain.

First off, ".children()" is incorrect. Use ":GetChilden" to get all Children of the model.

Try this code:

a = script.Parent.Model:GetChildren()

for i,v in pairs(a) do
	if v:IsA("Part") then --selects all children with the classname Part
	v.Position = script.Parent.BrickInThisModel.Position
	else
	return
	end
end

Hmm, try this;

wait(1)
for i, v in pairs(script.Parent.Model:GetChildren())do
if v:IsA("BasePart")then
v.Parent=script.Parent
end
end

Hope this helped!

function change(model,parent)
for i,v in pairs(model:GetChildren()) do
if v:IsA("BasePart") then
v.Parent = parent
end
end
end

change(workspace.TigerCaptain,workspace) -- this would essentially decapitate me.
change(workspace.Map,script.Parent) -- this would move all parts from map into script.Parent.

For this, you'd need to use the GetChildren Method and the for loop to take it into effect..

a = script.Parent.Model:GetChildren() wait(1) for i,v in pairs(a) do a.Parent = script.Parent end

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