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

'For' Loop Help?

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

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

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