How to reset pivot position via scripts

I have cars, with PrimaryParts set, thus their PivotPoints set to that. However, when I want to position them a specific point in the game, I need to just get their centre position.

But when I remove the PrimaryPart, the pivot stays at the same position

-- Create car
		local CarClone = Car.Model:Clone()
		CarClone:SetAttribute("ParkingSpot", EmptyParkingSpot.Name)
		
		CarClone.PrimaryPart = nil
		CarClone.WorldPivot = CFrame.new(0, 0, 0)
		local Orientation, VehicleSize = CarClone:GetBoundingBox()
		local SpawnPosition = EmptyParkingSpot.CFrame - Vector3.new(0, EmptyParkingSpot.Size.Y / 2)
		SpawnPosition = SpawnPosition + Vector3.new(0, 0.5, 0)
		CarClone:PivotTo(SpawnPosition * CFrame.Angles(0, math.rad(90), 0))

This just positions the car in the middle of nowhere


Where the axis is, thats where I want the car to be

You can probably set the model’s WorldPivot property to the CFrame returned from model:GetBoundingBox (in your script it’s the Orientation variable). Not sure what is used on the backend but that seems to do the trick.

I am not sure if this works:

-- Create car
		local CarClone = Car.Model:Clone()
		CarClone:SetAttribute("ParkingSpot", EmptyParkingSpot.Name)
		
		CarClone.PrimaryPart = nil
		CarClone.WorldPivot = CFrame.new(0, 0, 0)
		local Orientation, VehicleSize = CarClone:GetBoundingBox()
		local SpawnPosition = EmptyParkingSpot.CFrame - Vector3.new(0, EmptyParkingSpot.Size.Y / 2)
		SpawnPosition = SpawnPosition + Vector3.new(0, 0.5, 0)
		CarClone:PivotTo(SpawnPosition * CFrame.Angles(0, math.rad(90), 0))

		CarClone.Velocity = Vector3.new()
		CarClone.RotVelocity = Vector3.new()
		CarClone.AngularVelocity = Vector3.new()
		CarClone.Torque = Vector3.new()
		CarClone.MaxTorque = Vector3.new()
		CarClone.Position = SpawnPosition
		CarClone.Orientation = Vector3.new()
		CarClone.CFrame = SpawnPosition * CFrame.Angles(0, math.rad(90), 0)

		CarClone.Name = "Vehicle"
		CarClone.Parent = Workspace

Still spawns it in a random spot on the map

Well I cannot help you then anymore sorry.