Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 4 years ago
Edited 4 years ago

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

Log in to vote
0
Answered by 4 years ago

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.

1
Thanks @Narccs Retallack445 75 — 4y
2
another way of saying this is that because parts are positioned from the center changing the size makes it look like both directions testing34545 12 — 4y
Ad

Answer this question