How can i create a projectile system where it goes where the mouse is

so i would like to add something to my game for weapons.

i want my projectile to go to the mouse but only on the X and Z axis and have it disapear after a certain range.

how could i approach this in a simple way?

and how could i implement some anti exploits with it

read this thread:

or follow this tutorial:

I can’t explain much right now cause I’m at school, but it has to do something with the camera and UserInputService. Do UserInputService:GetMouseLocation() and convert it into a Vector3 direction using Camera:ViewportPointToRay() or something along the lines of that. You can search online for more info.