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

Vector3 Problem (changes part size in both directions) ?

Asked by 4 years ago

So I made this simple script that should make my part extend in 1 direction making it look like pouring water effect, but instead, it does it with its both sides (up and down), but how do I make it so it only goes down?

while true do
wait(.2)
for i= 1, 5 do
script.Parent.Size = script.Parent.Size * Vector3.new(1, 1.33, 1)
wait(.2)
end
end
0
they should had 2 size values - size and + size one is up other is down ect lon233bcc 31 — 4y

1 answer

Log in to vote
0
Answered by
noammao 294 Moderation Voter
4 years ago

One way that I learned through the "How to make a laser gun" tutorial is that in order to keep the same position while changing a part's size, you need to change its position.

while wait(.2) do

    for i= 1, 5 do  
        local FirstSize = script.Parent.Parent.Size
        script.Parent.Parent.Size = script.Parent.Parent.Size * Vector3.new(1, 1.33, 1)
        local secondSize = script.Parent.Parent.Size
        local sizetranform = secondSize - FirstSize

        script.Parent.Parent.Position = script.Parent.Parent.Position - Vector3.new(0, sizetranform.Y/2, 0)
        wait(.4)
    end
end

If you want me to explain what this script does and how it works I'll be happy to help.

Ad

Answer this question