I've figured out how to set the position, but it always changes its rotation from its initial one.
Here's the guilty part of my tools script
fakeBoat = boatModel:clone() fakeBoat.Parent = workspace fakeBoat.PrimaryPart = fakeBoat.redBoat mouseMoved = mouse.Move:connect(function() if mouse.Target.Name == "Water" then fakeBoat:SetPrimaryPartCFrame(CFrame.new(mouse.Target.CFrame.X,mouse.Target.CFrame.Y,mouse.Target.CFrame.Z)) end end) end end end
assume the rest of this works, because it does. It moves with this script based on my cursor, but the "fakeBoat" rotation is always 0, 0 , 0 i think.
Use Angles.
fakeBoat:SetPrimaryPartCFrame(CFrame.new(fakeBoat.PrimaryPart.Position) * CFrame.Angles(0,math.pi/2,0))
If you want to preserve the rotation of the boat, you will have to get the existing rotation before you move it, then add it on to the position.
The way you would do it is like this:
local previousRotation = fakeBoat:GetPrimaryPartCFrame() - fakeBoat.PrimaryPart.Position fakeBoat:SetPrimaryPartCFrame(CFrame.new(mouse.Target.Position) * previousRotation)
You may also wish to consider using mouse.Hit.p
rather than mouse.Target.Position
, but I'm not sure this fits with your specific case.
Hope this helps!