The Best Way to Handle a Mana System (With Server-Side Checks)

I have buttons on the Client which cast a spell with a loss of x amounts of mana. However, I don’t want to rely on the client to check if the player has enough mana. I would use a RemoteEvent, but I would need to notify the player, so I can use a RemoteFunction. The argument passed will be the spell to cast. The remote would return a boolean.

Is this the best way to handle a mana system? If not, how can I improve security in this structure?

1 Like

When using the spell, I would first check on the client if the player has enough mana, and if so, fire a RemoteEvent to the server to use the spell (on the server, check if the player has enough mana again, and then subtract the mana and fire a RemoteEvent to the client with the updated mana).

2 Likes

The problem is that my Stats is a module on the Server, so I can’t do the Client Check you stated.

I could use a RemoteFunction for that

Won’t you have basic data (such as mana or currency) exposed to the client? Such as for a mana bar? Anyways, if you are using a RemoteFunction, there is no need to check on the client.