So I am trying to make a food framework sort of like Minecraft. There’s food on the ground that has a specific tag and when the player touches it, the server tells the client to put the food in the viewmodel. However, I realized that a hacker could change the tag once its on the client side without the server knowing. How can I prevent the hacker from changing the tag and potentially getting tons of health? Thanks for your suggestions.
Double check that client-side tag changes actually replicate to the server. It shouldn’t, but I could be wrong. If it doesn’t, just check how much health to heal on the server. That’s what you should be doing anyway.
Yeah, the tag doesn’t change, but the problem with checking the tag is that my framework clones a client version of the object then puts the tag on (on the client). Then, an exploiter can easily just change the tag and the server would not even notice.
This thread and this article will assist you. Basically, never trust the client and implement server-sided checks.
I assume you are using the Collection Service. As far as I am aware, if the cloned object has already been tagged then there is no reason to tag it again.
This wouldn’t be a problem if you don’t let the client be authoritative of the contents of their inventory. When the player collects the item you can update a server-side copy of their inventory’s contents while telling the user to render the item in their ViewportFrame and then from there it doesn’t particularly matter if the client changes the model/item type or not.
When the client attempts to consume an item, have the server validate if the item exists in the server-side copy of the inventory. If it does and there’s sufficient quantity then remove that item and grant the benefits associated with the consumption of that item.