Best way to make a bullet?

I’m going to start making a gun for my game soon and I was wondering what is the best way to go about making a bullet?

I’ve handled projectiles in the past (not bullets) by using bodyvelocities and checking .Touched event however the touched event can be delayed and it wouldn’t be effective for something extremely fast like a bullet. I also plan on making bullets ricochet off certain materials as well. What would be the best way to go about doing this?

1 Like

i would say robloxs raycasting pretty much all i can tell you i don’t know much about the subject
like params Raycasting

2 Likes

There are a few steps that you’ll need to do to make a good gun for your game, however I’d say the best way to make it would be to first run the bullet on the client, get the bullet created there and send it to the server, do sanity checks and then run hit detection. It’ll also be a good idea to implement ping adjustment and then with that comes hitbox expander protection. You’ll have to use a multitude of tools for all of this, but you’ll be best off with Rays. There are some modules like FastCast Redux that automatically do some of this for you if you’d like to look into those too.

1 Like

I don’t think its the best idea to put it on the client because its just simply not that secure.
Also raycasting is instant and I don’t want my bullet to be instant. Just extremely fast.

Fastcast Redux, phantom forces and most games with guns handle shots on the client for the player because otherwise you’ll get a horrible input delay which is unfun and unresponsive which will just drive people away. A player can already spoof where their mouse will be so as long as you have the correct sanity checks it should be no different. Also, if you want it to be a projectile then you can either use a body mover which I wouldn’t recommend due to the nature of them or manually update its cframe every renderstepped/stepped (might get laggy, you can choose a less expensive method though), and then shoot mini rays every tick to see if it hits anything.

2 Likes

Also how would I go about making the bullet appear on other clients as well?

1 Like