Hello, I’m working on a Tower Defense game on the platform, and There is something that I have a slight issue with to do with my Mob hovering GUI (Where, it displays Stats of an enemy when you hover your cursor over it). I implemented a working Shield health where it shows a yellow bar over the health bar, it works perfectly fine in gameplay and almost perfectly in GUI
The slight issue arises if shield health is more than the max health of the humanoid, where it just overlaps the bar where the actual health is shown. picture reference is down below.
The code below is what handles all of that Shield Health and when to show it in the HoverGUI. Is there a way to make it so the Shield Health stays within the borders of the health GUI?
if Config:FindFirstChild("ShieldHP") and Config:FindFirstChild("ShieldHP").Value > 0 then -- Shield HP Showing
local ShieldHPFrame = HoverGui.HealthFrame.ShieldHealth
ShieldHPFrame.Visible = true
local ShieldPercent = Config.ShieldHP.Value / MobHumanoid.MaxHealth
ShieldHPFrame.Size = UDim2.new(ShieldPercent,0, 1,0)
HealthFrame.Health.Text = (MobHumanoid.Health + Config:FindFirstChild("ShieldHP").Value) .. "/" .. MobHumanoid.MaxHealth
else
HoverGui.HealthFrame.ShieldHealth.Visible = false
HealthFrame.Health.Text = MobHumanoid.Health .. "/" .. MobHumanoid.MaxHealth
end
I’d appreciate the help if needed.