I've been trying to make a simple projectile shot with a tool recently. I've tried using so many methods (although I don't think I fully understood any of them) and all of them somewhat worked, but never how I wanted it to. I want to move a part that I created with Instance.new("Part") to the Player Mouse.Hit.p vector3 position. I've tried bodyposition, bodyvelocity, rocketpropulsion, tweening, and lerping. All of these seem to not work the way I want them to. I want the object to move at a constant speed (regardless of distance) to the mouse position, then disappear. I've tried using the lookVector of the mouse.Hit but it seems to always move the part to a certain distance away from your player to the area you clicked, not to the object you clicked on, if that makes sense. I feel like I'm over complicating this, please tell me if I am. Any help is appreciated.
If you want the movement to be perfectly smooth then you need to connect to RenderStepped, which fires every render frame and includes the time elapsed. Assuming filtering is enabled, a signal will need to be sent to the server to have it handle collisions and effects and replication, but rendering is handled by the client. Using RenderStepped to interpolate the part position is the smoothest way to move it.
local function Interpolate(part, destination, speed) local origin = part.CFrame local duration = (destination - origin.p).magnitude/speed local velocity = (destination - origin.p)/duration local elapsed = 0 repeat part.CFrame = origin + velocity*elapsed elapsed = elapsed + game:GetService("RunService").RenderStepped:Wait() until elapsed > duration end