Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

Making a gun: What should be Handled by the Server and the Client?

Asked by 7 years ago
Edited 7 years ago

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

1 answer

Log in to vote
5
Answered by
RubenKan 3615 Moderation Voter Administrator Community Moderator
7 years ago

You should ask yourselves the following questions:

--Can the server do it?
--Can the client do it?
--If the client does it, is there a security risk?

Examples:

Bullet count:

--Can the server do it? Yes
--Can the client do it? Yes
--If the client does it, is there a security risk? Infinite ammo & Never reloading.

--> Server should do it.

Swap firemodes:

--Can the server do it? Yes
--Can the client do it? Yes
--If the client does it, is there a security risk? No.

--> Client should do it.
Ad

Answer this question