I've tried to figure this out many times and I just can't seem to do it. I know that this code below:
1 | part = script.Parent |
2 |
3 | for i = 1 , 10 , 1 do |
4 | part.Size = Vector 3. new(part.Size.X + 1 ,part.Size.Y,part.Size.Z) |
5 | wait( 0.1 ) |
6 | end |
-changes the size of the part but it changes in the direction of negative X and positive X, but I just want it to change only on the direction of positive X. How could I do that?
1 | local Part = script.Parent |
2 | local AddNumber = 1 --The amount of studs added in each loop. |
3 | local SizeAddition = 10 --How many times the script adds "AddNumber". |
4 |
5 | for i = 1 ,SizeAddition do |
6 | wait() |
7 | Part.Size = Vector 3. new(Part.Size.X + AddNumber,Part.Size.Y,Part.Size.Z) |
8 | Part.CFrame = Part.CFrame - Vector 3. new(AddNumber/ 2 , 0 , 0 ) |
9 | end |
I think this is what you are looking for.
The following method will work:
1 | local part = script.Parent |
2 |
3 | for i = 1 , 10 do -- u dont need the "1" after the 10, because it already goes up by ones without that |
4 | part.Size = part.Size + Vector 3. new( 1 , 0 , 0 ) -- so here you are making the Size of the part the same, but just adding to the x, or y, or the z axis, this adds 1 stud every 1/30 seconds to the x axis |
5 | wait() -- wait() is the least wait you can have in a server script which is also equivalent to wait(1/30) |
6 | end |
Hope it helped :)