In a localscript, I am detecting mouse movement and changing a parts position according to the mouse position.
This works and is fine and all.
The problem is- I want to change the position via server… obviously I cannot get the mouse position on a server script, so I have to fire a remote event everytime the mouse moves to the server.
Its a 2D game where a part with a trail follows ur mouse where u go, it raycasts from the mouse onto a grid part and puts the part position to that everytime Mouse.Move occurs.
I see, In this case then I don’t know what else to possibly recommend that wasnt already recommended to you.
Its different and more responsive than when using the Mouse.Moved event.
perhaps with a task.wait() while loop or binding it to RunService.RenderStepped could work out for you.
As for the lag, there will always be network ping delay to take into account, and thats beyond whats in our control.
Oh its the smoothness in the change whats concerning you? Like its choppy and bounces from one place to another? in this case instead of setting the part position on the server script, use TweenService to tween the position to the new position, Maybe try doing that with your Mouse.Moved method you already scripted first and see how it works out.
Edit: I recommend trying setting the time of the tween to ~1/60th of a second, i.e TweenInfo.new(1/60) theres default values for the other settings so they aren’t as necessary, also if you end up using the looping method I still recommend using tweens.
Do you know how I’d tween it being a model and using this method? Slice:SetPrimaryPartCFrame(CFrame.lookAt(Slice.PrimaryPart.Position, Pos)) Slice:MoveTo(Pos)
Slice is the part that is moving. Pos is the position of the raycast the part should move to. The first line is making the Slice part LOOK at the position (because I want rotation to change so its looking at the position its going to), then the second is moving it.