How to resize part on one side

Hello, I’m working on my free release and I got this problem. How I can resize part on one side.

Example
Example is only oppening compartment door.

I tried to make this and it resizeon both sides. Thank you anyone who helps.

1 Like

try moving it to counter the size

You would also have to Tween the part to stay at the same position, so it doesn’t move away. Again, haven’t done it before, but let me know if it works out for you.

1 Like

I edited the post, It is only compartment door.

Can you explain more of what you said.

so like
if ur reducing the size X of a part by 1
u have to move the parts X position by either -0.5 or 0.5 depending which side it goes

so once the part resized on both sides you move it to create the illusion of only resizing in one side

1 Like

Alright, I will try that and see if it works.

Try this:

function adjust(part, NewLength)
	if math.max(NewLength, part.Size.Y) == NewLength then
		part.Position = part.Position - Vector3.new(0, math.abs(part.Size.Y - NewLength) / 2, 0)
	else
		part.Position = part.Position + Vector3.new(0, math.abs(part.Size.Y - NewLength) / 2, 0)
	end
end

this is the script to do it. This worked for me.

3 Likes

This is for Y only. ok this is for only y not z either.

2 Likes

I will try, thanks for responding.

This works for the Y axis only. All you need to do is change some of the values to make it work for all axis.

1 Like

Also, I have a question. What do you put as “NewLength” ?

Instead, try looking at this function, it looks like it matches what you need.

1 Like

New Length is what you want the size to be. A number. Not a vector3.

1 Like