My custom health bar script isn't working, Why? [solved]
It's supposed to make my custom health bar change the color from red to green, and change the size, but it doesn't do anything, why?
01 | function barFunction(plr) |
02 | local gui = plr.PlayerGui:WaitForChild( "Health" , 99 ) |
03 | local hbar = gui:WaitForChild( "Bar" , 99 ) |
04 | local playerhp = gui:WaitForChild( "PlayerHealth" , 99 ) |
05 | local maxhealth = gui:WaitForChild( "MaxHealth" , 99 ) |
06 | local percent = playerhp.Value / maxhealth.Value |
07 | playerhp.Changed:connect( function () |
11 | hbar.BackgroundColor 3 = Color 3. new(red,green, 0 ) |
13 | hbar.Size = UDim 2. new( 0 ,percent * x, 0 ,y) |
18 | game.Players.PlayerAdded:Connect( function (plr) |