-
What do you want to achieve? Keep it simple and clear!
I want to make a custom healthbar overhead gui. -
What is the issue? Include screenshots / videos if possible!
The problem is that the health bar doesn’t change. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried making it from tutorials but again it didn’t work or I’m doing something wrong.
This is the server script that I’ve put in StarterCharacterScripts.
local char = script.Parent
local hum = char:FindFirstChild("Humanoid")
local healthgui = script.BillboardGui
local filler = healthgui.Background.Filler
local tweenservice = game:GetService("TweenService")
healthgui.Adornee = char.Head
local Health = hum.Health
local MaxHealth = hum.MaxHealth
local percentage = Health/MaxHealth
local function HealthChanged()
filler:TweenSize(UDim2.new(percentage, 0, 1, 0), "In", "Linear", 1)
end
hum:GetPropertyChangedSignal("Health"):Connect(HealthChanged)