Answered by
6 years ago Edited 6 years ago
If you want to make the part stay in place but increase size, then it's important to know that: when you add X amount of size, the relativity for positioning it is 1/2 X. But since you want the part to go down,
read the following:
If you want the part to go down, but you don't want it to go through the baseplate, use an if
statement, like so:
04 | for i,v in pairs (script.Parent.Parent:GetChildren()) do |
05 | if v.Name ~ = "FieldTouch" then |
06 | if v.Health.Value < 2 then |
07 | local median = (v.Size.Y - v.Health.Value) |
08 | v.Size = v.Size - Vector 3. new( 0 ,median, 0 ) |
09 | if v.Position.Y - median > = 1 then |
10 | v.Position = v.Position - Vector 3. new( 0 ,median, 0 ) |
12 | v.Position = v.Position - Vector 3. new( 0 ,median / 2 , 0 ) |
What that does, is if the part is shrinking and going down and about to go through the baseplate, then it will make it only shrink and not go down.
Let me know if this worked by accepting my answer! If it still didn't work, or you have trouble understanding something, leave a comment and I will reply.