What is best way to set up guns?

I am trying to make some weapons, and I was wondering what the best way to set up the weapons is. The two ways that I can think of are:

  1. making each weapon have its own individual scripts and events

  2. Using one server script and a local script in the player to control all of the weapons.

Any help is appreciated. (I am having a hard time trying to figure this one out.)

1 Like

do you want full scripts, or me just telling you what to use to make a gun?

I know how to make the scripts, I was just wondering which method of making guns was the best.

Personally, I handle all of the hit detection and ray casts on the server.

It isn’t the best solution but prevents players from cheating heavily and increasing things like damage this was a huge issue on a game I worked on that hired me to solve a cheating problem that plagued their game.

Truly having scripts inside your gun isn’t a bad thing and sure it’s not nice and tidy but you won’t notice any major performance differences.

The only thing I trust the client with is fire rate then calculate the bullet spread drop damage velocity on the server.

FastCast is an amazing solution to easily building raycasts

2 Likes

i know this is a really old post but why would you trust the client with fire-rate, wouldn’t they just be able to spam remote events and spam shots?

Yes absolutely someone could do that, that’s why you check that the incoming fires come in you just ignore them if they’re outside of the time delay.

Instead of a player clicking fire then the server checks if the player can fire, then tells the client yes okay shoot then the player shoots and then the server says okay fire accepted, its more of a client says fire server agrees or disagrees.

1 Like