nevermind, i have no idea what i’m doing and i still cannot get it to work
A reply above mentioned capping health at 5 hp and that’s what most games do, I’m sure theres a tutorial on youtube somewhere. If you want to go the extra mile, I would just make a separate Health system entirely. It would be very flexible and isn’t too much work.
Health = {}
Health.__index = Health
function Health.new(...) -- Character or Player depending on if NPCS can use it
local self = {} -- Current Health, Max Health, Knocked, Invincible, etc. I would limit the amount of variables going into this because if you already have a State handler it would probably get redundant
-- You can insert the character / player param into the health table OR you should probably parent this table to a player's data table if you have one
Health[--Character, Player, or other identifier like the PlayerData] = self
return setmetatable(self, Health)
end
function Health.Remove(Key)
Health[Key] = nil -- Cleans up
end
-- These methods are pretty self explanatory and you can customize them really easily
function Health:Damage()
end
function Health:Knock()
end
function Health:Revive()
end
function Health:Finish()
end
-- Using it
local HealthModule = path.to.HealthModule
local Key = -- Either the character, player, or some player data store, this is whats going into the new function
local MyHealth = HealthModule.new(Key) -- Run this when either the player or character gets added to the game
-- Examples of what using it looks like
MyHealth:Damage()
MyHealth:Knock()
You could probably set this up fully in an hour or less and I would really recommend it because it gives you the flexibility to expand on health systems further (incase you want to add something or rework something it would take you 12 years to sift through every script and wont take another 12 years to write out every edge case in any instance you want to do something with health)
Right, like he said, turn off the roblox health gui, create your own health giu, that shows your custom health values / status, then all of your weapons or damage are tied into your own health system and you have full control. then if you want to really kill the player, do full damage on the real roblox health system. (after you have done your custom stuff when their health is low). …
i’m still trying to figure out how to do it like in the video i sent, i cant think of a good method to do it
The easiest way is to set their health to 0.1 and set an attribute like “Downed”. After downing them you can implement the delayed death mechanic. The “Downed” attribute is for additional damage to be ignored. For example, a gun shooting the downed player would see the “Downed” attribute is present and it’s damage towards the downed player would be ignored. If you wanted to kill them after they don’t get revived after x seconds then you can just fully kill them.
Edit: For setting their HP to 0.1 part, you’d have to check if the damage you’re dealing is greater than the available enemy’s HP and then you’d set their HP to it
i think i got it, i was right about using 2 NumberValues, you dont need to use HumanoidStateType to disable death behavior, here’s how it should work:
- Every script that damages a player will not subtract Humanoid.Health, Instead will subtract the CurrentHealth Value
- if the value reaches 0 or negative numbers, a timer starts, then if that timer ends, it’ll set your Health (not health value) to 0 and you’ll actually die
Umm ya, thats exactly what I said!
Nice !
oh right, i didnt see your message mb