How can I correctly add sanity checking from the server for weapon related stuff like ammo?

Hey! I’m making a weapon framework, so far its been pretty smooth all things considered, But I have an issue, security.

I want to add sanity checks from the server to make the player has not manipulated stuff like the Ammo, But I dont know how I go about doing it, Could someone push me in the right direction?

Currently I store ammo as a variable for the gun in the client script.

Thanks in advance.

The only thing I can recommend is that you do everything from the server, just use the client to send the signals: the player pressed R and for a remote event the weapon reloads, nothing else, that way it is safer.

1 Like

What SOTR654 said as well as a few logic checks along the way using some if statements.
I’m not the best myself with these types of things - but when dealing with security I just check for unrealistic situations occasionally.

Did a player move from Point A to Point B at an unrealistic rate?
Does a players “Current Ammo Capacity” make sense relative to what’s expected? [ if a clip is 30, why do they have more than 30 in their clip?
Does a player have an absurd amount of max ammo? [ 1000 total instead of 240 max? ]

You really have to get creative with these things I believe. Ask yourself, if you were an exploiter, what would you exploit? Then find ways to counter those actions.

I’m sure there are better ways - this is just all the advice I can provide.

1 Like