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

How would I change the size of a part in a certain direction?

I've tried to figure this out many times and I just can't seem to do it. I know that this code below:

part = script.Parent

for i = 1,10,1 do
	part.Size = Vector3.new(part.Size.X + 1,part.Size.Y,part.Size.Z)
	wait(0.1)
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?

6 comments

0

Go here for help http://wiki.roblox.com/index.php?title=API:Class/BasePart/Resize The first parameter is the side, which is 0 - 5, the second part is how many studs\

0

That didn't really help.

0

Try using part:Resize(0, 1) or part.Resize(0, 1)

0

It worked but it's only resizing it by 1. I want it to resize now by 0.2.

0

Then just write 0.2 instead of 1.....

0

Ugh so dumb, it only works with whole numbers.

2 answers

✓ Accepted answer
local Part = script.Parent
local AddNumber = 1 --The amount of studs added in each loop.
local SizeAddition = 10 --How many times the script adds "AddNumber".

for i = 1,SizeAddition do
	wait()  
 	Part.Size = Vector3.new(Part.Size.X + AddNumber,Part.Size.Y,Part.Size.Z) 
	Part.CFrame = Part.CFrame - Vector3.new(AddNumber/2,0,0)
end 

I think this is what you are looking for.

2 comments

0

Finally!

0

xD

The following method will work:

local part = script.Parent

for i = 1, 10 do -- u dont need the "1" after the 10, because it already goes up by ones without that
    part.Size = part.Size + Vector3.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
    wait() -- wait() is the least wait you can have in a server script which is also equivalent to wait(1/30)
end

Hope it helped :)

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