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

Why doesn't this loop work? [Solved]

Asked by 10 years ago

As far as I'm concerned, this should work:

for _,v in pairs(workspace.Model:GetChildren() do
    if v.Name~="Part21" then
        v.Size=v.Size+Vector3.new(17,0,-17)
        v.CFrame=CFrame.new(v.CFrame.p,
        v.Parent['Part'..tostring(tonumber(string.sub(v.Name,5))+1)].CFrame.p)
    end
end
  • The Model is named Model, in the Workspace.
  • The Model consists of Parts labeled in order as "Part1" to "Part21"

As far as I'm concerned, this should work.

2 answers

Log in to vote
1
Answered by 10 years ago

You forgot the closing parenthesis for your pairs()

for _,v in pairs(workspace.Model:GetChildren()) do
Ad
Log in to vote
0
Answered by 10 years ago

On line 1, you need an extra ")" after the "()"

Correct:

for _,v in pairs(workspace.Model:GetChildren()) do

Answer this question