My health bar functions correctly except for the fact that the bar covers the text. Where did I go wrong in the code?
Low Health: http://prnt.sc/evsfg5
After some regeneration: http://prnt.sc/evsfkq
Code:
local info_holder = script.Parent:WaitForChild("Info_Holder")
local health = info_holder:WaitForChild("Health")
local old_health = humanoid.Health
local old_maxhealth = humanoid.MaxHealth
function update_health()
health:TweenPosition(UDim2.new((-((humanoid.MaxHealth-humanoid.Health)%humanoid.MaxHealth)/humanoid.MaxHealth), 0, health.Position.Y.Scale, 0), "Out", "Quad", 0.25, true)
info_holder.Health_Amount.Text = math.floor(humanoid.Health+0.5) .. " / " .. math.floor(humanoid.MaxHealth+0.5)
if(old_health > humanoid.Health and old_maxhealth == humanoid.MaxHealth) then
old_health = humanoid.Health
blood_effect()
end
old_health = humanoid.Health
old_maxhealth = humanoid.MaxHealth
end

2 comments
Try fiddling with the Text's Z-Index to make it above everything.
Thanks