Where do I :PivotTo?

If I have instances, that are sometimes simply just a basepart, and other times are baseparts inside of a model (no primary part)

How do I :PivotTo with them?

I know with a model, I can use WorldPivot, but what is the equivalent for just a basepart?
Also, would I need to detect each time if it is a model or basepart and use the correct property?

Also, if they have pivot points, how do I account for those, or do I ?

You would use the :IsA() method under a condition to check whether it’s a BasePart or a Model.

I know with a model, I can use WorldPivot, but what is the equivalent for just a basepart?

^ An equivalent to WorldPivot would be Vector3 or CFrame for a BasePart. Though a BasePart does have a Pivot property, only it’s PivotOffset can be manipulated through code.

if object:IsA("BasePart") then -- :IsA() method
    -- Use CFrame or Vector3 to do something
elseif object:IsA("Model") then
    -- Use :PivotTo() to do something
end

You just use BasePart:GetPivot(), and pass that into :PivotTo().

I didn’t realize there was a :GetPivot method, must have overlooked it, thanks

1 Like

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