Health stops regening after 100 [Look at reply 15 for properly formatted code]

Alright, Hi guys.

Now before I explain my issue I KNOW this was similar to a previous post before, I’ve read that post, I tried to solution, but it didn’t work.

So here’s what’s up. I have a stat system, once your health levels up (You get health exp by taking damage or healing) you get 20+ max health, now, for some reason, your health doesn’t heal after 100, say you’re level 4 and you have 180 health, you keep spawning with 100/180 health, if you take damage you heal up-to 100 and then stop there.

Here’s my code:
local front = script.Parent.FrontLayerHealthBar
local textLabel = script.Parent.HealthNumber
local healthChange = game:GetService(“ReplicatedStorage”):WaitForChild(“HealthChange”)

local plr = game.Players.LocalPlayer
local character = plr.Character
local tweenService = game:GetService(“TweenService”)

local healthFadeLimit = character:WaitForChild(“Humanoid”).Health <= character:WaitForChild(“Humanoid”).MaxHealth * 0.2
local fadeFrame = script.Parent.Parent.HealthFade

local Event = game.ReplicatedStorage:WaitForChild(“HealthChange”)
local Player = game.Players.LocalPlayer
local Character = Player.Character

if character:WaitForChild(“Humanoid”).Health == character:WaitForChild(“Humanoid”).MaxHealth then

else
Event:FireServer()
print(“Fired”)
end

character:WaitForChild(“Humanoid”).MaxHealth = game.Players.LocalPlayer.Stats.HealthLevel.Value * 20 + 80
textLabel.Text = tostring(math.floor(character:WaitForChild(“Humanoid”).Health + 0.5)…“/”…character:WaitForChild(“Humanoid”).MaxHealth)
local tweenStart = tweenService:Create(front, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {Size = UDim2.new(character:WaitForChild(“Humanoid”).Health / character:WaitForChild(“Humanoid”).MaxHealth, 0, 0.75, 0)})
tweenStart:Play()

function update()

local tween1 = tweenService:Create(front, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {Size = UDim2.new(character:WaitForChild("Humanoid").Health / character:WaitForChild("Humanoid").MaxHealth, 0, 0.75, 0)})
tween1:Play()

textLabel.Text = tostring(math.floor(character:WaitForChild("Humanoid").Health + 0.5).."/"..character:WaitForChild("Humanoid").MaxHealth)

game.Players.LocalPlayer.Stats.HealthExp.Value = game.Players.LocalPlayer.Stats.HealthExp.Value + 2
if game.Players.LocalPlayer.Stats.HealthExp.Value == 100 then
	game.Players.LocalPlayer.Stats.HealthExp.Value = 0
	game.Players.LocalPlayer.Stats.HealthLevel.Value = game.Players.LocalPlayer.Stats.HealthLevel.Value + 1
	character:WaitForChild("Humanoid").MaxHealth = game.Players.LocalPlayer.Stats.HealthLevel.Value * 20 + 80
end

Event:FireServer()
print("Fired")

end

character:WaitForChild(“Humanoid”):GetPropertyChangedSignal(“Health”):Connect(function()

update()

if character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.01 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.50})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.02 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.52})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.03 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.54})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.04 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.56})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.05 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.58})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.06 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.60})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.07 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.62})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.08 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.64})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.09 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.66})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.10 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.68})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.11 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.70})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.12 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.72})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.13 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.74})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.14 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.76})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.15 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.78})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.16 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.80})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.17 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.82})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.18 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.84})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.19 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.86})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.20 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.88})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.21 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.90})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.22 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.92})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.23 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.94})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.24 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.96})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.25 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.98})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health >= character:WaitForChild("Humanoid").MaxHealth * 0.26 then
	fadeFrame.Visible = false
	fadeFrame.Fade.ImageTransparency = 1
end

end)

character:WaitForChild(“Humanoid”):GetPropertyChangedSignal(“MaxHealth”):Connect(function()

update()

end)

Code that receives the healing fireserver:
local Event = game.ReplicatedStorage:WaitForChild(“RemoteEvent”)

Event.OnServerEvent:Connect(function(Player)
print(“Recieved”)
local Char = Player.Character
local healStep = Char.Humanoid.MaxHealth * 0.012
Char.Humanoid.Health = Char.Humanoid.Health + healStep
end)

Okay… Sorry about that, the code came out a little weird

local front = script.Parent.FrontLayerHealthBar
local textLabel = script.Parent.HealthNumber
local healthChange = game:GetService(“ReplicatedStorage”):WaitForChild(“HealthChange”)

local plr = game.Players.LocalPlayer
local character = plr.Character
local tweenService = game:GetService(“TweenService”)

local healthFadeLimit = character:WaitForChild(“Humanoid”).Health <= character:WaitForChild(“Humanoid”).MaxHealth * 0.2
local fadeFrame = script.Parent.Parent.HealthFade

local Event = game.ReplicatedStorage:WaitForChild(“HealthChange”)
local Player = game.Players.LocalPlayer
local Character = Player.Character

if character:WaitForChild(“Humanoid”).Health == character:WaitForChild(“Humanoid”).MaxHealth then

else
Event:FireServer()
print(“Fired”)
end

character:WaitForChild(“Humanoid”).MaxHealth = game.Players.LocalPlayer.Stats.HealthLevel.Value * 20 + 80
textLabel.Text = tostring(math.floor(character:WaitForChild(“Humanoid”).Health + 0.5)…“/”…character:WaitForChild(“Humanoid”).MaxHealth)
local tweenStart = tweenService:Create(front, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {Size = UDim2.new(character:WaitForChild(“Humanoid”).Health / character:WaitForChild(“Humanoid”).MaxHealth, 0, 0.75, 0)})
tweenStart:Play()

function update()
al tween1 = tweenService:Create(front, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {Size = UDim2.new(character:WaitForChild("Humanoid").Health / character:WaitForChild("Humanoid").MaxHealth, 0, 0.75, 0)})
tween1:Play()

textLabel.Text = tostring(math.floor(character:WaitForChild("Humanoid").Health + 0.5).."/"..character:WaitForChild("Humanoid").MaxHealth)

game.Players.LocalPlayer.Stats.HealthExp.Value = game.Players.LocalPlayer.Stats.HealthExp.Value + 2
if game.Players.LocalPlayer.Stats.HealthExp.Value == 100 then
	game.Players.LocalPlayer.Stats.HealthExp.Value = 0
	game.Players.LocalPlayer.Stats.HealthLevel.Value = game.Players.LocalPlayer.Stats.HealthLevel.Value + 1
	character:WaitForChild("Humanoid").MaxHealth = game.Players.LocalPlayer.Stats.HealthLevel.Value * 20 + 80
end

Event:FireServer()
print("Fired")


end

character:WaitForChild(“Humanoid”):GetPropertyChangedSignal(“Health”):Connect(function()


update()

if character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.01 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.50})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.02 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.52})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.03 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.54})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.04 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.56})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.05 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.58})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.06 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.60})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.07 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.62})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.08 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.64})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.09 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.66})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.10 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.68})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.11 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.70})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.12 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.72})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.13 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.74})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.14 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.76})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.15 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.78})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.16 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.80})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.17 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.82})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.18 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.84})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.19 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.86})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.20 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.88})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.21 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.90})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.22 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.92})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.23 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.94})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.24 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.96})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.25 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.98})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health >= character:WaitForChild("Humanoid").MaxHealth * 0.26 then
	fadeFrame.Visible = false
	fadeFrame.Fade.ImageTransparency = 1
end


end)

character:WaitForChild(“Humanoid”):GetPropertyChangedSignal(“MaxHealth”):Connect(function()


update()


end)

Code that receives the healing fireserver:
local Event = game.ReplicatedStorage:WaitForChild(“RemoteEvent”)

Event.OnServerEvent:Connect(function(Player)
print(“Recieved”)
local Char = Player.Character
local healStep = Char.Humanoid.MaxHealth * 0.012
Char.Humanoid.Health = Char.Humanoid.Health + healStep
end)

Perfect thank you, how did you do that?

idk i just copy pasted the code and formatted it :^p

How do I format, I just leveled up my trust level so I’m kinda new :sweat_smile:

this script is way too long you could’ve used simple math and for loops

The long part is only the health fade, I realized AFTER I made the whole thing work so i just left it, the part that doesn’t work is the regen

wheres the regen part??? the script is too long for me lol

The function that’s called “update()” fireservers the regen, now go to the very end of the code and you’ll see “Code that recieves the fireserver”

Try this:

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local head = character:WaitForChild("Head")
local front = head:WaitForChild("Front")

local tweenService = game:GetService("TweenService")

local healthChangeEvent = game.ReplicatedStorage:WaitForChild("RemoteEvent")

local function update(healStep)
    local healthFadeLimit = 0.5 -- Adjust this value as needed
    local tweenInfo = TweenInfo.new(2, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)

    local tween1 = tweenService:Create(front, tweenInfo, { Transparency = healthFadeLimit })
    local tween2 = tweenService:Create(front, tweenInfo, { Transparency = 0 })

    tween1:Play()
    tween1.Completed:Wait()
    tween2:Play()

    humanoid.Health = humanoid.Health + healStep
end

healthChangeEvent.OnClientEvent:Connect(function(healStep)
    if humanoid.Health < humanoid.MaxHealth then
        update(healStep)
    end
end)

Here’s what i did:

Improvements made to the code include:

Simplified event handling: The event name and handler function have been updated to be consistent with each other, and the Player and healStep arguments are properly used in the event handler.

Removed unused variables: The healthChange and plr variables have been removed since they were not being used.

Added missing module import: The TweenService module is now imported at the beginning of the script.

Clarified variable names: The variable names have been made more descriptive to enhance code readability.

Moved Event:FireServer(): The line Event:FireServer() has been moved outside the if condition to ensure the event is fired regardless of the health condition.

And please please please don’t,never and EVER repeat the elseif statements because that’s pure programming warcrime

Got any ideas on what might be going wrong?

Ahhh! This completely broke my health bar! Sorry about the elseif statements, I didn’t realize I could have used loops until AFTER I was finished

Oops,guess I’ve ruined the whole code lol

I think you didn’t quite understand my code due to it being horrible formatted, here it is:

local front = script.Parent.FrontLayerHealthBar
local textLabel = script.Parent.HealthNumber
local healthChange = game:GetService(“ReplicatedStorage”):WaitForChild(“HealthChange”)

local plr = game.Players.LocalPlayer
local character = plr.Character
local tweenService = game:GetService(“TweenService”)

local healthFadeLimit = character:WaitForChild(“Humanoid”).Health <= character:WaitForChild(“Humanoid”).MaxHealth * 0.2
local fadeFrame = script.Parent.Parent.HealthFade

local Event = game.ReplicatedStorage:WaitForChild(“HealthChange”)
local Player = game.Players.LocalPlayer
local Character = Player.Character

if character:WaitForChild(“Humanoid”).Health == character:WaitForChild(“Humanoid”).MaxHealth then

else
Event:FireServer()
print(“Fired”)
end

character:WaitForChild(“Humanoid”).MaxHealth = game.Players.LocalPlayer.Stats.HealthLevel.Value * 20 + 80
textLabel.Text = tostring(math.floor(character:WaitForChild(“Humanoid”).Health + 0.5)…“/”…character:WaitForChild(“Humanoid”).MaxHealth)
local tweenStart = tweenService:Create(front, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {Size = UDim2.new(character:WaitForChild(“Humanoid”).Health / character:WaitForChild(“Humanoid”).MaxHealth, 0, 0.75, 0)})
tweenStart:Play()

function update()
al tween1 = tweenService:Create(front, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {Size = UDim2.new(character:WaitForChild("Humanoid").Health / character:WaitForChild("Humanoid").MaxHealth, 0, 0.75, 0)})
tween1:Play()

textLabel.Text = tostring(math.floor(character:WaitForChild("Humanoid").Health + 0.5).."/"..character:WaitForChild("Humanoid").MaxHealth)

game.Players.LocalPlayer.Stats.HealthExp.Value = game.Players.LocalPlayer.Stats.HealthExp.Value + 2
if game.Players.LocalPlayer.Stats.HealthExp.Value == 100 then
	game.Players.LocalPlayer.Stats.HealthExp.Value = 0
	game.Players.LocalPlayer.Stats.HealthLevel.Value = game.Players.LocalPlayer.Stats.HealthLevel.Value + 1
	character:WaitForChild("Humanoid").MaxHealth = game.Players.LocalPlayer.Stats.HealthLevel.Value * 20 + 80
end

Event:FireServer()
print("Fired")


end

character:WaitForChild(“Humanoid”):GetPropertyChangedSignal(“Health”):Connect(function()


update()

if character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.01 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.50})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.02 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.52})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.03 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.54})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.04 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.56})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.05 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.58})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.06 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.60})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.07 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.62})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.08 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.64})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.09 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.66})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.10 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.68})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.11 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.70})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.12 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.72})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.13 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.74})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.14 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.76})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.15 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.78})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.16 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.80})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.17 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.82})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.18 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.84})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.19 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.86})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.20 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.88})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.21 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.90})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.22 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.92})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.23 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.94})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.24 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.96})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth * 0.25 then
	fadeFrame.Visible = true
	local tween1 = tweenService:Create(fadeFrame.Fade, TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {ImageTransparency = 0.98})
	tween1:Play()
elseif character:WaitForChild("Humanoid").Health >= character:WaitForChild("Humanoid").MaxHealth * 0.26 then
	fadeFrame.Visible = false
	fadeFrame.Fade.ImageTransparency = 1
end


end)

character:WaitForChild(“Humanoid”):GetPropertyChangedSignal(“MaxHealth”):Connect(function()


update()

end)

Code that receives the fireserver in ServerScriptService:

local Event = game.ReplicatedStorage:WaitForChild(“RemoteEvent”)

Event.OnServerEvent:Connect(function(Player)
print(“Recieved”)
local Char = Player.Character
local healStep = Char.Humanoid.MaxHealth * 0.012
Char.Humanoid.Health = Char.Humanoid.Health + healStep
end)

Don’t worry about it :sweat_smile:
I’ve ruined my own code even worse than that countless of times :sweat_smile: :sweat_smile:

try to add an if statement to check if the health is under or equal the maxhealth

That’s the first thing I did, right under the variables:

if character:WaitForChild(“Humanoid”).Health == character:WaitForChild(“Humanoid”).MaxHealth then

else
Event:FireServer()
print(“Fired”)
end

try to make it <= instead of ==

I think it’s something with the receiving script, this is what I did to the if-statement:

if character:WaitForChild("Humanoid").Health <= character:WaitForChild("Humanoid").MaxHealth then
	print("Healing")
	Event:FireServer() 
end

It printed “Healing” in the output, now the receiving script:

local Event = game.ReplicatedStorage:WaitForChild("RemoteEvent")

Event.OnServerEvent:Connect(function(Player)
	print("Recieved")
	local Char = Player.Character
	local healStep =  Char.Humanoid.MaxHealth * 0.012
	Char.Humanoid.Health = Char.Humanoid.Health + healStep
end)

It never printed “Received”