I made custom hp and hp regen but whenever the player gets damaged their health gets reverted back to 100 and damaged. Before it wasnt healing them back to maxhp so I made my own regen.
how fix? Code:
local Plr = game.Players.LocalPlayer local Char = Plr.Character local Hum = Char.Humanoid local HumRoot = Char.HumanoidRootPart local Health = 145 local Regen = 2 -- Health gained per regen rate local Walk = 25 local Run = 2.25 local JumpPower = 65 local Defense = 15/100 local REGEN_STEP = 0.5 -- Wait this long between each regeneration step. Hum.MaxHealth = Health Hum.Health = Health Char.Health:Destroy() -------------------------------------------------------------------------------- local Character = Char local Humanoid = Character:WaitForChild'Humanoid' -------------------------------------------------------------------------------- while true do while Humanoid.Health < Humanoid.MaxHealth do local dt = wait(REGEN_STEP) Humanoid.Health += Regen end Humanoid.HealthChanged:Wait() end
Put a empty script in StarterCharacterScripts, then, rename the script "Health".