I have a script that uses a tween to fire a bullet that goes reasonably fast.
The problem is, the bullet has a touched event that can’t fire, because the bullet moves too fast.
I’ve already given the bullet a bigger hitbox, but that didn’t do anything.
The general way that people make gun’s work now is to use a Raycast, then use the bullet simply as a visual representation of the shot.
Detect what the raycast hits, then make that take damage
Adding onto what @SeargentAUS has said, you should definitely use raycasting to do this.
If you don’t have a starting point for this I have a Video for you to go off of to hopefully assist you with this task, there are multiple different ways to achieve this. The person I have linked has helped me with multiple things and I feel like they could definitely help you.
You can still keep your script with the way that the bullet is moving just remove the .Touched damage part of the script.
How would I make it only deal the damage when it hits, though?
I’m not aiming to make the damage instant, as I’m wanting players to have to calculate where the enemy will be in a certain amount of time.
I’m thinking magnitude between the bullet and players, but I’m not sure if there’s a better solution.
In the video that I attached, it shows how you would detect the hit event and how to deal the damage. It should answer everything for you while being able to go at your own pace and visualize things easier.
Use RunService to check every frame if it’s touching.
Instead of the touched event use raycasting and Part:GetTouchingParts to detect it.
Or just use raycasting by itself it’ll be the same I think