Making a non exploitable mana system?

Im trying to make a system where you can charge mana and the more you charge it over time your mana reserves get bigger. Im firing a remote every half second well the g key is down(g is the key to charge mana). My first question is whats the best way to make a system like this? My second question is how to I keep exploiters from spamming the mana remote and hacking the system?

1 Like

As for the question on spamming the remote, you could throw a check on the server to make sure the last tick the player did a check on is greater than or equal to 0.5 seconds from the last one. Not absolutely sure about the rest of this question.

1 Like

You’ll want to have the server do every necessary sanity check and make the server authoritative over the amount of mana or mana storage.

Make sure the server properly debounces the requests so that the system does not rely on a local cooldown timer.

2 Likes

How do i make a debounce on the server for a client?

You will want an accurate denounce on client, and a more forgiving/simpler denounce on server. If the server denounce fails, there is a good chance exploiting is occurring. Log player name/time, and short penalize player.

Personally the way I would do this is move the loop to the server and then have a remote to say “hey I’m holding the G key” or “hey I’m not holding the G key.”

This way you don’t need to worry about ping or rate limiting or anything.

Cool thread I found on how to monitor remotes, the reply shown here in the embed talks about the leaky bucket algorithm.

I recommend you read this thread for context and further information. It seems that it is very pertinent to your topic.

4 Likes

Here’s what I used to make a debounce/cooldown script, hope it helps.