I have this code I found on the DevForms, however when I execute the code the model goes into a random orientation rather than a straight tween.
local function tweenModel(model, CF)
local CFrameValue = Instance.new("CFrameValue")
script.Parent.Cash.PrimaryPart = MainPart
CFrameValue.Value = model:GetPrimaryPartCFrame()
CFrameValue:GetPropertyChangedSignal("Value"):Connect(function()
model:SetPrimaryPartCFrame(CFrameValue.Value)
end)
local tween = tweenService:Create(CFrameValue, info, {Value = CF})
tween:Play()
tween.Completed:Connect(function()
CFrameValue:Destroy()
end)
end
I execute the function with this:
tweenModel(MainPart.Parent, CFrame.new(script.Parent.Main_.Position))
How can I fix the problem so it evenly tweens out properly?

1 comment
For this part (script.Parent.Main_.Position) make sure it's orientation is the same as the primary part's, also note, if you set the orientation in the script, it will act like setting position, and may put it on top of the register