So I'm making a gun, and I'm wondering what should be handled by the server and by the client, in the most lagless and unhackable way. Here are some information about the gun I'm making:
-Uses raycasting
-The gun holds x amount of bullets, each shot eats 1 bullet.
-The user holds x amount of spare bullets.
-Reloading
-Has a min and max spread, and each shot adds x amount of spread of the gun, and over time the spread diminishes.
-The gun draws a beam and plays sounds
-Has different firemodes (semi, auto)
-Has a gui when you equip the gun
You should ask yourselves the following questions:
1 | --Can the server do it? |
2 | --Can the client do it? |
3 | --If the client does it, is there a security risk? |
Examples:
Bullet count:
1 | --Can the server do it? Yes |
2 | --Can the client do it? Yes |
3 | --If the client does it, is there a security risk? Infinite ammo & Never reloading. |
4 |
5 | --> Server should do it. |
Swap firemodes:
1 | --Can the server do it? Yes |
2 | --Can the client do it? Yes |
3 | --If the client does it, is there a security risk? No. |
4 |
5 | --> Client should do it. |