Part follow mouse smoothly

Hey devs, I have tried to make my plane follow my mouse using run service and then CFrame’ing the part (plane) to follow my mouse position every frame, but its too fast and laggy looking.

Code for CFrame’ing it every frame:

Remote.OnServerEvent:Connect(function(player, mouse)
	local BasePos = Base.Position --  the plane
	Base.CFrame =,, mouse.Y, mouse.Z))

How could I make the part follow the mouse smoothly? Perhaps there’s a more efficient way of doing this?

Any help appreciated!!


Yes, you can do this on the client instead. You just need to give network ownership, which is done automatically in your case.

The problem isn’t because of network conflict between the Client and server, the problem is the fact that its moving too fast per frame because of CFrame’ing it every frame.

I’m asking if there’s a more efficient way to make the plane (part) follow the mouse.

You can do Base.CFrame = Base.CFrame:Lerp(yourCFrameHere, 0.1) to make it move more smoothly and less fast.

1 Like

You also can use align orientation to move it more smoothly.

AlignOrientation would align the orientation of Attachment1 to Attachment0, how could I apply this to my case, could you explain?

Anyone know how I could do this?

Just assign one of the atachment points to mouse.hit position.

I have thought about that, but that wouldn’t align the plane with the mouse’s orientation since the mouse doesn’t have orientation…

My code:

-- remote is being fired every frame the player is in the plane
Remote.OnServerEvent:Connect(function(player, mouse)	
	local AlignOrientation ="AlignOrientation")
	AlignOrientation.Attachment1 = mouse
	AlignOrientation.Attachment0 = Base -- plane

I get this error:
Unable to assign property Attachment1. Object expected, got Vector3


You need to make an attachment parented to terrain and then set that attachment’s position to the position of the mouse. You only need to create the AlignOrientation/Position once, not every time you call the remote.

This works, but how can I change the Attachment’s orientation so the plane’s orientation will also change.

As you can see in the video, the attachment is following the mouse position but the plane is not taking on any new orientation, only when I manually change the orientation of the attachment using the Rotate tool the plane follows the orientation of the attachment.

You can set the attachment’s CFrame using Mouse.Hit, not Mouse.Hit.Position.

This worked, I set the attachments CFrame to equal Mouse.Hit, although the problem still persists, the actual flying is very sensitive and unpredictable.
I’m using LinearVelocity for the upward and forward movement.

i think you should use tweenservice for this, it makes things very smooth trust me
heres a post on the roblox doc about tweenservice TweenService | Roblox Creator Documentation