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)