i need a health system like in super cube cavern(roblox), or the binding of isaac. both have a health system based on hearts, every time something deals damage to you, you lose half a hearth. i want the player to start with only 3 heaths but i also want it so that lets say touching a part can increase you max health by 1 hearth. any help?
I don't know if this is a very good answer, I'm kinda inexperienced and new, but what i would try is to make the hearts in the gui change depending on the local character's humanoid's health. Like i guess for example if the player has over 82 health (which is like 2 and a half of the health) the third heart would be on. and if the health is less that 82 and above 66 the heart would be half. Or what you could do is have the players have 6 health opposed to 100 and have the enemies deal like 1 damage (1/2 heart). What this would do is make it easier to understand since 1 health would be like half a heart and 2 health one heart and so on. For the healing part u could heal like 2 health. Sorry if this is a really bad response, I'm super amateur.
To bounce off Wild_Newbies response. Since every damage only does half a heart you could do a system where you give the player 6 health total and whenever is hit by whatever object subtract one from the health bar. You can do this with your own custom heart GUI where you use
humanoid.HealthChanged:Connect(function(damage) --decrease half a heart end)
and for the touched events, it's quite simple
local debounce = false part.Touched:Connect(function(hit) debounce = true hit.Parent.Humanoid.MaxHealth += 1 player.HealthValue.Count.Value += 1 --this will be used to know when to add another heart end)
ofc you'd have to define what part, in particular, you want to be touched
and for the spawning of new hearts based on your health
game.Players.PlayerAdded:Connect(function(player) local folder = Instance.new("folder", player) folder.Name = HealthValue local Count = Instance.new("NumberValue", folder) local Count.Name = "Count" local Count.Value = 0 Count.Changed:Connect(function() if Count.Value == 2 then Count.Value = 0 --then you would have to either fire the server ot communicate or clone it from --here end end end)
I kinda wrote this just off the top of my head but this should give you an idea what to do if you need further information I can provide