Setting model position on top of a part without setting the model's position to the center

I’ve already made a script that sets a model’s position on top of a basepart.
But the problem is, I can’t find a way to set the model’s position on top while not setting
the model’s position to the center.

Current code:

local floorY = workspace.Baseplate.Size.Y/2;
local modelY = workspace.ShadowFigure:GetExtentsSize().Y/2;
local Yposition = floorY + modelY;
local diff = workspace.ShadowFigure:GetBoundingBox().p - workspace.ShadowFigure.PrimaryPart.Position

workspace.ShadowFigure:PivotTo(CFrame.new(workspace.Baseplate.Position + Vector3.new(0,Yposition,0)) - diff);

To make it more clear, This is what I want to happen:

Instead of this:

1 Like

It’s likely doing that because the value of Position is the center of the part.

Instead of using workspace.Baseplate.Position in your PivotTo, maybe try making your own Vector3, with the X and the Z being your ShadowFigure’s PrimaryPart’s position (So the model stays in place), and the Y being the Baseplate’s position

1 Like

You can CFrame the Position of A at the vertical height of B + 1/2 the vertical height of A.
Or B’s Position + 1/2 the height of B + 1/2 the height of A.

1 Like

My wifi was down for about 2 days. Sorry for the delay but this seems to fix it.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.