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
