Reset WorldPivot of Objects

I was building with F3X when I realized, due to the new beta features that display WorldPivot points & allow movement from those, It makes the built-in building tools a little difficult to use.

I wrote this to help me fix those WorldPivot issues, maybe someone else might find this useful.
It just calibrates the pivot point of all workspace parts to the center of them.

vvv Goes in command bar vvv

for index, value in pairs(workspace:GetDescendants()) do
	if value:IsA("Model") then
		local BoundingBoxOrientation = value:GetBoundingBox()
		local WorldPivotAngles = CFrame.fromAxisAngle(value.WorldPivot.LookVector, 0)
		value.WorldPivot = CFrame.new(BoundingBoxOrientation.Position) * WorldPivotAngles
	end
end
12 Likes