Move pivotpoint to bottem of model

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    i am making a building spawn system (plugin)
    i want to move the pivot point of a building to the bottem of the model

  2. What is the issue? Include screenshots / videos if possible!
    afbeelding
    buildings now clip trough the floor.
    the code i worte doenst do anything to move the pivotpoint

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

				model.WorldPivot = boundingbox - Vector3.new(
					0,
					boundingbox.Y/2,
					0)
				model:PivotTo( boundingbox - Vector3.new(
					0,
					boundingbox.Y/2,
					0))

no warnings, no error messages. just not doing what i want

Here you’re using the boundingbox which might not be the right position. Instead you should get the pivot, though you might’ve just named the right position boundingbox.
Also instead of a minus you want to use a plus like so:

local mouse = player:GetMouse()
local wantedCFrame = CFrame.new(mouse.Hit + Vector3.new(0, boundingbox.Y / 2, 0)) -- I assume you want it at the cursor's position

model:PivotTo(wantedCFrame)

So in conclusion you used the model’s size instead of position and you moved it downward instead of up.

Also you can manually change the pivot in studio:

You have to use Model:PivotTo() instead. (ex. Model:PivotTo(CFrameThing)

Easiest solution to correctly position this is, place a part where you want it to take reference from (In this instance you’d place the part on the ground), and then set the primary part of the model to the part.

(To be clear; set the primary part from here, NOT during run time)
image

Blockquote “Also you can manually change the pivot in studio:”

i am using it for a plugin.
and this moves the model to the mouse. it does not alter the pivot point.
i want the pivot point on a grid so when i need to move the building i can jsut do it by the pivotpoint.

Blockquote You have to use Model:PivotTo() instead. (ex. Model:PivotTo(CFrameThing)

can u show me an example. is it like model:PivotTo(),Cframe(vector3.new(0,0,0)???
it is for a plugin as i have to do a lot of models