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

Vector3 Problem (changes part size in both directions) ?

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

1 comment

0

they should had 2 size values - size and + size one is up other is down ect

1 answer

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.

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