I’m trying to create a gun and I have everything good. The only issue is is that each time it shoots a bullet, it goes down onto the ground.
(example)
Allot of people have said to use bodyposition, but then how do I get rid of the whole position thing? (Prevent the bodyposition from moving the bullet to the set position)
Optionally, use BodyForce with an upward direction (the same force as gravity) then just set its Part’s Velocity. This negates gravity’s effects on the part and lets you set it’s velocity without worrying about gravity.
I would use RunService.Heartbeat where it casts a ray to check for a target in the direction it’s moving. If theres a target, it damages them ( or whatever you want to happen whenever the target gets hit), disconnects the heartbeat, and destroys the bullet. If theres not a target, it moves the bullet forward.
Keep in mind the bullet would have to be anchored and ideally non collidable.
If you don’t want to use heartbeat, you can just use a bodyvelocity, and set its maxforce to vector3.new(math.huge,math.huge,math.huge) so it doesnt get affected by gravity. You could handle hits through raycasting or the .Hit event