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

How do we Position all Children?

Asked by 4 years ago
local parts = game.Workspace.Parts:GetChildren()
local Spawn = game.Workspace.Spawn 

parts.Position = Spawn.Position

-- is there is anything Wrong? am not getting any error in the output 

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Use for i, v in pairs() to get the children

here's an example script

for i, v in pairs(game.Workspace.Model:GetChildren()) do
    if v:IsA("Part") then
        v.Name = "Lol"
    end
end

This will name all of the parts in the Model "Lol"

So to position them you'll need to do

for i, v in pairs(game.Workspace.Parts:GetChildren()) do
v.Position = Position
end
Ad

Answer this question