I tried creating something that shrinks, it shrinks but i want to break the loop when the mesh scale is at 0,0,0 this is my script;
while true do script.Parent.Part.Mesh.Scale = script.Parent.Part.Mesh.Scale - Vector3.new(.01, .01, .01) wait(.1) if script.Parent.Part.Mesh.Scale == Vector3.new(0, 0, 0) then break end end
obviously the error is
if script.Parent.Part.Mesh.Scale == Vector3.new(0, 0, 0) then
pretty much my question is how do i make an if statement to vector3?
Your IF statement is correct, but, unfortunately, when you're lowering the scale, it won't low .01 a time, it would low 0.0100000(something). So it will NEVER reach zero.
So where you have
if script.Parent.Part.Mesh.Scale == Vector3.new(0, 0, 0) then
You should have
if script.Parent.Part.Mesh.Scale <= Vector3.new(0, 0, 0) then
So, it will break the script when the scale is equal or lower than ZERO.
But it would leave a little mesh. So, after the loop. it's time to set the scale to zero.
script.Parent.Part.Mesh.Scale = Vector3.new(0, 0, 0)
Rewritten script
while true do script.Parent.Part.Mesh.Scale = script.Parent.Part.Mesh.Scale - Vector3.new(.01, .01, .01) wait(.1) if script.Parent.Part.Mesh.Scale <= Vector3.new(0, 0, 0) then break end end script.Parent.Part.Mesh.Scale = Vector3.new(0,0,0)
But this script doesn't work. I had made changes to it
while script.Parent.Part.Mesh.Scale.X > 0 and script.Parent.Part.Mesh.Scale.Y > 0 and script.Parent.Part.Mesh.Scale.Z > 0 do script.Parent.Part.Mesh.Scale = script.Parent.Part.Mesh.Scale - Vector3.new(.003,.003,.003) --increase or reduce it like you want wait() -- fluid shrinking end script.Parent.Part.Mesh.Scale = Vector3.new(0,0,0) -- it will force the total shrinking of the part