i feel using if statements is a bad idea and will cause alot of bugs so what can i use instead that would be easier and less buggy
ROBLOX has a specific event for this called HealthChanged
. It does exactly what it suggests: fires when the player's health changes. It's really easy to use;
local player=game.Players.LocalPlayer local humanoid=player.Character.Humanoid local currentHealth=humanoid.Health --getting the current health humanoid.HealthChanged:connect(function(health) --Passes the parameter "health". It's just what it changed to local change=math.abs(currentHealth-health) --Getting the absolute value (Humanoid health is usually a decimal) print(player.Name.."'s health "..(currentHealth>health and "decreased by " or "increased by ")..change.."!") --This will tell you whether the health increased or decreased end)