How would I make it so that it can start at 50,0,0 and move 1 increment as this makes it start at 1,0,0
for i = 1, 50 do workspace.Part.CFrame = CFrame.new(i, 0,0) wait(1) end
How would I make it so that it can start at 50,0,0 and move 1 increment as this makes it start at 1,0,0
for i = 1, 50 do workspace.Part.CFrame = CFrame.new(i, 0,0) wait(1) end
You have two options here:
Option 1:
for i = 1, 50 do
workspace.Part.CFrame = CFrame.new(51 - i, 0, 0)
wait(1)
end
Option 2:
for i = 50, 1, -1 do --Note the third number. This is the increment and is optional (defaults to 1)
workspace.Part.CFrame = CFrame.new(i, 0, 0)
wait(1)
end
This discussion is preserved as it was. New answers, comments, and votes are closed.
4 comments
He wants to increment not de-increment.(From what I can tell)
He previously asked a question involving incrementation, and the wording also implies decrementation.
Both is good but how do I get increment?
for VAR = START, END, INCREMENT do creates a variable called var which starts at START and whose value is increased by INCREMENT until END is