✓ Accepted answer
The offset of a mesh is in measured in studs and the scale is measured in a percent multiplier of the actual size of the mesh. You want to offset the window by half as much as it scales down by, so you'll have to get these two things to the same units of measurements.
In order to do that, we will have to calculate the actual size of the mesh [i.e. the size the mesh is when it is scaled at 100% in all directions (scale = Vector3.new(1, 1, 1))]. The easiest way to do this right now is to copy the MeshId into a MeshPart and record the size of that part. This will be the size of the bounding box of the mesh.
In the case where the mesh doesn't have a MeshId or the edge of the mesh you want to 'stay still' doesn't extend up to the bounding box, you will have to figure out the size in a different way. What you will want to do is create a part and make the outside edges of the part line up (as close as you possibly can) with the edge you want it to resize from. Record the size of that part.
Now that we have the size of the part at 100% scale, we can calculate the offset we need to make the part to appear to scale from one direction instead of the origin.
Example: Shrink mesh down from the top face by half of original size
local size
local mesh
local function scaleMesh(scale)
mesh.Scale = scale
mesh.Offset = (size*scale - size)/2
end
scaleMesh(Vector3.new(1, 0.5, 1))
Note that this will likely take some adjustments to get working correctly, but it is the only way I am aware of.
5 comments
It doesn't have a MeshId, it's just a BlockMesh.
Okay, well because the BlockMesh resizes to match the size of the part it is in, the size property in the code snippet I posted would be the size of the part it is parented to (as the scale is relative to that size). So basically ignore the 2nd and 3rd paragraphs in my answer.
Alright, I'll try it, thanks.
It works, thank you so much. :)
No problem :)