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

'For' Loop Help?

Asked by 10 years ago

So when Clicked, I want the dummy to be raised up, stop, then more stuff.

I'm not sure how to put together the ends and stuff

The problem is that it keeps going up without stopping.

house =  script.Parent

local Part = house:GetChildren() --Make a table of the parts in the model
while true do --15 times
for i=1,#Part do --Loop through each part (Part[i] is the part we're looking at)
if Part[i]:IsA("BasePart") then --If its a part and not a value or something
Part[i].CFrame = Part[i].CFrame + Vector3.new(0,0.5,0)
end
end
wait(0.1)
end
wait(2)
for i=1,#Part do --Loop through each part (Part[i] is the part we're looking at)
if Part[i]:IsA("BasePart") then --If its a part and not a value or something
Part[i].CFrame = Part[i].CFrame + Vector3.new(0,0.5,0)
end
end

1 answer

Log in to vote
0
Answered by 10 years ago

You made 2 loops into 1 script without ever telling them when to stop. End does not stop a loop from running.

Ad

Answer this question