So i’ve been trying to lay out a folder of models in a line with the command bar, here’s what I have rn
local mans = game.Workspace.SecretChars:GetChildren()
local lastpos = nil
for i, v in pairs(mans) do
if lastpos ~= nil then
v:SetPrimaryPartCFrame(CFrame.new(v.PrimaryPart.Position) + Vector3.new(5, 0, 0))
lastpos = v
end
v:SetPrimaryPartCFrame(CFrame.new(183.269, 3, 68.588) + Vector3.new(5, 0, 0))
lastpos = v
end
Although this isnt what you’re asking for, you can change your code to this:
local mans = workspace.SecretChars:GetChildren()
local xfive = Vector3.xAxis*5 -- equivilent to Vector3.new(5,0,0)
local lastPos -- doesnt require nil
for i, v in pairs(mans) do
if lastPos then -- if lastPos isnt nil
v:PivotTo(CFrame.new(v.PrimaryPart.Position + xfive)) -- SetPrimaryPartCFrame is deprecated, so you should be using PivotTo
lastpos = v
end
v:PivotTo(CFrame.new(183.269, 3, 68.588) * CFrame.new(xfive)) -- may not be correct
lastpos = v
end
You aren’t referencing the previous character so the position would just keep putting them all in the same place. I changed the “v.PrimaryPart.Position” to be “lastpos.PrimaryPart.Position” so that it will shift from the previous character over instead of putting them all in the same spot. You should just need to replace your code lines with what I gave you.