essentially i have a regenerating health function in my game that heals you at a relatively fast rate. when i set my health to exactly 101.2, which is the damage of the Light Sniper in my game, sometimes i will survive being hit by it as long as i was regenerating health. ive attached results of the server script that does the damage, and added printing of health before and after damage was applied. is this a roblox engine bug? because it seems to be undocumented. (i ran a local script that prints health whenever it is changed and it always said that health never reached 0, instead the lowest it got was exactly how much health is regained every tick of regeneration without any floating point inaccuracies)
#player character survives at ZERO health (according to the server)
1 messages · Page 1 of 1 (latest)
ig you probably mean the healing script which its pretty simple, this runs every .1 seconds on the server as long as you are dealing damage actively
im certain it never runs faster than 0.1 seconds
print("Hello World") why is my print not printing anything?
Part.AssemblyLinearVelocity=Vector3.yAxis*9999999 why is no velocity happening?
humanoid:TakeDamage(100) why is no damage happening?
plr:Kick() why is player not being kicked?
do you see the issue with these questions?
the issue is no one can tell anything about your code based on one line.
i specifically need to see what context the code is running to really diagnose anything
like do you have both the regeneration and takedamage in the same event? - who knows
hence simply
i'll clarify, taking damage and healing are seperate server events
im more wondering if the reason why the player survives is because of how roblox handles health and death internally because i couldn't find anything concrete regarding it on the docs other than When the value of the character's health reaches 0, the Humanoid automatically transitions to the Enum.HumanoidStateType.Dead state.
and the server plainly says that the humanoid has 0 health for an instant but is allowed to heal again and survive
my best guess is that sometimes healing happens on the same heartbeat or tick as the damage and roblox only checks to see if it should kill a player afterwards, resulting in what happened above
but to me this seems like an engine bug, especially since im basically taking my maxhealth as damage but living
anyway more to the point i just checked with this local plr=game.Players:FindFirstChildOfClass("Player") local hum=plr.Character.Humanoid::Humanoid hum:TakeDamage(100) hum.Health=1 and it does not kill the player
not necessarily a bug, just a quirk
so to fix this i just need to use a function to check if health is zero immediately after dealing damage?
this will kill the player but only if ran on client for some reason local plr=game.Players:FindFirstChildOfClass("Player") local hum=plr.Character.Humanoid::Humanoid hum:ChangeState(Enum.HumanoidStateType.Dead) hum.Health=1
well for one you should be checking this yourself like i am, simply running some small commands to check what happens
but naw i think just check if health is above 0 before healing

thanks
this one tells a lot. changestate doesnt kick in until one frame later local plr=game.Players:FindFirstChildOfClass("Player") local hum=plr.Character.Humanoid::Humanoid hum:TakeDamage(100) hum:ChangeState(Enum.HumanoidStateType.Dead) print(hum:GetState()) hum.Health=1
so depending on the order which your 2 events run, i assume heal is in heartbeat and the damage is in a remote event, if the damage runs first and the heal is second you survive, but if the heal is first and damage is second you die
so yea just make it not rely on that order, always check if things are valid before doing them