Sorry if I’m posting in the wrong category, idk which to post in
I’m curious on how other devs out there handle the stats of their weapons.
We all know the traditional way of storing values inside a Configuration will no longer works, the client can just simply change the values which opened a big door towards exploiters, so, what’re your approaches?
Let me explain mine first. I’m really concerned on the way that I did it, I think it neither can be exploited nor it is inconsistent.
I have a large module script that includes all weapons’ stats, it’s a big table. When player joins, it fired to the client as a reference. Stats like taking damage can be done from server, just simply find the corresponding weapon’s stats’ damage then deal it! However some stats such as Fire rate, reload time can’t be fetched from server every single time when they fire a gun, players with high ping will suffer a lot. Here raises my first question:
Can exploiters change those values that’re stored inside a Local Script?
Alright, let’s move on. I used to have a variable CurrentWeapon that stores the players’ equipped weapon. It’s fetched from the server. When a player equips a weapon, the client will check that weapon for it’s corresponding stats base on the variable CurrentWeapon. I found this inconsistent, because a player can only own one weapon at the time, even if they have 2 different weapons in backpack, they will share the same stat base on CurrentWeapon. I know I can use a table instead, but I have to do more stuff like indexing them, like what if player switches their order in backpack? I also tried to find a tool’s stats according to the tool name but everything is done in client, so if an exploiter changes the tool name, so do the stats.
So, I’ve switched to another solution. My long term goal is to completely deprecate the CurrentWeapon value, no matter on client or server. Right now whenever a player equips a weapon, it will use a Remote Function to fetch weapon’s data (and welding the tool to player because I don’t use tool handles). Is this a good way? My major concern is on the latency, I also have a custom “EquipTime” which is an amount of time that the tool have to wait before it’s able to shoot (mostly less than a second) and it’s also stored in the Weapon stats table. Now I have to do something with tick() and subtraction in order to make sure the draw time complete on time. This also solves the problems I’ve mentioned above, including tool name changing, multiple tools etc.
I don’t really need a solution or improvements to my current system right now (but feel free to give any suggestions to it!), but I’m really curious on how other devs handle it. Hope I’ll see any new/ innovative/ consistent solutions that ya’ll have!