Stamina/Mana system in games?

What’s the best way of making a value for each player character and npc, that can be changed from anywhere on the server, such as a mana or stamina value. I’ve done this before with NumberValues but i’d like to know if there’s a more efficient way of doing this, maybe creating a table in a module script?

Anyone who has done a game with this feature before , please tell me your preffered way of doing this

If you use _G with a table, you could use that table across multiple scripts. Here is an example -

-- first script
_G.Players = {game.Players:GetChildren()}
-- second script
print(_G.Players)
1 Like

Actually everytime i do something like that, i use attributes, binding attributes “mana” to player and then changing it from every other script. For me it is the fastest way and efficient to do it.

1 Like

Plus, attributes changed by the client does not replicate to the server at all, removing a possible vulnerability depending on how the scripts operate.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.