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

Vector3.new Not working as interpreted......?

if you have a script and you do this small little script:

local block = script.Parent

while true do
	wait(0.1)
	block.Size = block.Size+Vector3.new(1,0,0)
	wait(0.1)	
end

its supposed to change the X size of the part. this is what i mean

<------ part ------>

what i mean with "<------ part ------>"

the arrows represent the direction the part changing size

What i want:

<------ part

only one way/direction that the part changes the size.

is it possibe?

1 answer

✓ Accepted answer

To do this, you need to extend the block in the forwards direction (the Z component). The issue is that Roblox scales your size changes, as you have noted (it grows in both directions). Basically, you combat this by changing the CFrame as well as the size. See the example below, taken from a devforum post:

while true do
	wait(.2)
	script.Parent.Size = script.Parent.Size + Vector3.new(0,0,1)
	script.Parent.CFrame = script.Parent.CFrame + script.Parent.CFrame.LookVector * .5
end

Here is the devforum post.

2 comments

1

Thanks @Narccs

2

another way of saying this is that because parts are positioned from the center changing the size makes it look like both directions

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