What is the best approach to making a player statistics / health system

Hi! im developing a loadout shooter game and i need help finding the best way to implement a health / stats system.

My main questions are:

  1. What is the best way to implement a such systems so its hard to exploit and easy to manage, including Datastore saving?
  • So far i been thinking of :
    a) Using folders under players and saving values inside the folder
    b) using a ModuleScript with an arraylist holding each player and their stats.
  1. How to prevent Roblox’s default health system from interfering with my own implementation?
  • Will the default health system interfere with it? and if so how do i stop it from doing that?

I would really appreciate some code examples as it is my first time doing something like that. Thank you very much!

2 Likes

You could have either a datastore save a table and load a table, which is a good way of doing stats. You can also do the folder under the player idea, which I have made a datastore with that system before that you can check out.

No the default health system should not interfere unless you’ve got something specific in mind, if its just increasing maxhp then set the maxhp of the player when they join the game. If your worried about health regen just fork the health script from the character and put in startercharacterscripts and edit it.

Thanks! i will definetly check your system out. My concern about the default system interference is because my system needs to have a “per limb” health thing. where there is not a single health bar but rather smaller separate ones and then using some rules game can define if player should or shoudlnt be dead.

You can just delete Roblox’s default health script from the character.

You could place this inside of a server script inside of ServerScriptService so everyone’s default roblox health script get’s destroyed:

game.Players.PlayerAdded:Connect(function(plr)
      plr.CharacterAdded:Connect(function(char)
             if char:FindFirstChild("Health") then
                   char.Health:Destroy()
             end
      end)
end)

If you encounter any errors let me know because I didn’t write this out in studio.

2 Likes

Woudlnt this only disable the health regeneration though? Best case scenario for me would to be able to disable it entirely (the visual effects on getting hurt, health bars ui and in game world, etc.) Im still going to try it i will come back with a reply and see if that works.

You wanted to get rid of Roblox’s health regeneration system right or no?

As long as you don’t change the character’s humanoid health itself you dont have to worry about it. You can make your own health system via. the limbs and roblox’s health system shouldn’t interfere as long as you dont use it/mess with it.

Thats great, Thank you very much.

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