Hi, so I’m trying to make a gun tool and I’ve gotten it to deal damage to the target and everything, but I want to make a part that starts at the tip of the pistol and ends at the position the mouse is over, like but I’m not sure how I would get a part to start and end at specific points. Are there any ways of going about this?
you can use tween service to tween the built to the distance between the gun and the target. Or you can use a body force I believe and make it shoot in the direction of the target
I mean like a part that represents a direct line from the gun to the target. Is there a way to make a part represent a raycast?
You could use mathematics to calculate the trajectory of the projectile, however, this may become a bit complex if you have not taken physics/calc. The easiest way would be to fire the projectile using Roblox velocity physics, then every frame or so cast a ray where the position of the bullet is; this will allow you to keep track of the projectile in real time. However, you would need to replicate this from client to server to prevent delay and latency.
yea there is. I forgot exactly how to do it though
I kind of disagree to a certain degree. I honestly would just calculate slope or something and lerp accordingly if im not using roblox forces. I believe when using Roblox forces and velocity the bullet drop is already done by roblox I believe. Im not sure though I haven’t messed with it in a very long while though
Oh wait I take back what I said about slope. Using slope would mean its a straight line. Use the quadratic formula instead.