So I made a Health Bar but the problem is that when I add myself more MaxHealth in the Humanoid, the bar just goes off the limit of the frame.
Let me show you the screenshots.
When I don’t add MaxHealth
When I add MaxHealth
Bar Script
wait()
game.StarterGui:SetCoreGuiEnabled("Health",true)
game.StarterGui:SetCoreGuiEnabled("Health",false)
local Player = game.Players.LocalPlayer
repeat wait() until Player.Character
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
Humanoid.HealthChanged:Connect(function()
script.Parent.Overlay:TweenSize(UDim2.new(Humanoid.Health/Humanoid.MaxHealth,0,1,0),"Out","Quad",.25)
end)
I think an easy fix would be to not add the max health to the bar, but instead, just change the number and have the HP drain proportionately to the max hp