I'm making a game that required me to make a custom health. I made the custom health and scripted it. But, it seems it's not working fully right.
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
local player = game.Players.LocalPlayer
repeat wait() until player.Character
local humanoid = player.Character:WaitForChild("Humanoid")
local TheMathPart = humanoid.Health / (humanoid.MaxHealth)
script.Parent:TweenSize(UDim2.new(0,-215,0,10), "Out", "Sine", .5)
function CustomHealth()
local TheMathPart = humanoid.Health / (humanoid.MaxHealth)
script.Parent:TweenSize(UDim2.new(TheMathPart,-215,0,10), "Out", "Sine", .5)
end
humanoid.HealthChanged:connect(CustomHealth)
The thing is that when I made the health 50%, it went down like it was suppose too. But, when the health started regenerating, it would just keep going instead of going back.
Also...when taken damage the health would move to the right, yet I wanted it to go left...if that makes sense. Basically, I want my health to start toward the right, and when taken damage it would move toward the left. Sorry if I'm confusing everybody!
Help would be very appreciated!

2 comments
You didn't include the regenerateing health code.
I looked through the object browser and I don't see anything about regenerateing health.