A bullet is an entity, storing the ID of the player who fired it and the direction of the bullet, maybe also what weapon fired it, the speed and the damage depending on the game
It’s programmed to move until it finds another player or the ground and if it hits a player, damage is applied and since it knows who fired it you can do What You need to do.
Another even simpler way that is used is to, when a player presses the trigger, look for all players in a straight line form the muzzle and damage the first one, since it’s instant, there is only one player that can shoot in that instant and you don’t need to store the player who shot it or anything, but this is falling out of use because it’s less accurate
Latest Answers