How to revert model back to original orientation after converting it to a tool?

I have a model that originally had an orientation of 0,90,0, but now has an orientation of 0,0,0 because I manually changed its WorldPivot.

I have a script that moves the contents of this model into a tool and welds them together. That works fine, but the only issue is that the tool grip is at the wrong orientation.

I tried setting the tool grip to the model’s orientation and the original handle’s orientation in the original model, but neither of them work.

Setting the tool grip to the model’s orientation sets it to 0,0,0 because I set the model’s WorldPivot to 0,0,0 manually.

Setting the tool grip to the handle in the original model sets the grip to 0,90,-90, which places the model at the wrong position. (image below)

My code:

-- clone model
local model = game.ReplicatedStorage.Items[name]:Clone()
local orientation = model.Base.CFrame - model.Base.CFrame.Position
model.Base.Name = "Handle"

-- create tool
local tool = Instance.new("Tool")
tool.Name = name
tool.CanBeDropped = false
tool.TextureId = ItemsModule[name].Image
tool.ToolTip = "Baked"

-- move parts into tool
for _, v in ipairs(model:GetChildren()) do
	if v:IsA("BasePart") then
		v.Anchored = false
	end
	v.Parent = tool	
end
					
tool.Grip = orientation
1 Like

Welcome to Euler’s Math.
It makes no sense, but it actually does.
There is no XYZ as you expect, but instead “Pitch,Yaw and Roll”
Too long to explain, and if you want a simple solution, use the CFrame.fromEulerAnglesYXZ constructor for now.

1 Like

When you move a model into a tool, the tool grip needs the handle’s rotation relative to the model, not the world. Since you changed the WorldPivot, copying world rotation won’t work.

1 Like

The model was moving to the correct orientation. I’m unsure why it looked like it was facing outwards. My guess is that the default Roblox grip has the tool facing away from the player.