The numbers getting crazy How do I fix it?
I made a custom hp bar, And the color supposed to be between red and green but the color keeps going to numbers like 69000 what is going on???
05 | game.Players.PlayerAdded:Connect( function (plr) |
07 | local gui = plr.PlayerGui:WaitForChild( "Health" , 99 ) |
08 | local hbar = gui:WaitForChild( "Bar" , 99 ) |
09 | local playerhp = gui:WaitForChild( "PlayerHealth" , 99 ) |
10 | local maxhealth = gui:WaitForChild( "MaxHealth" , 99 ) |
11 | local persec = gui:WaitForChild( "PerSecond" , 99 ) |
12 | local percent = playerhp.Value / maxhealth.Value |
14 | playerhp.Changed:connect( function () |
15 | playerhp = gui:WaitForChild( "PlayerHealth" , 99 ) |
16 | maxhealth = gui:WaitForChild( "MaxHealth" , 99 ) |
17 | persec = gui:WaitForChild( "PerSecond" , 99 ) |
18 | percent = playerhp.Value / maxhealth.Value |
20 | local green = 255 * playerhp |
21 | local red = 255 - green |
22 | hbar.BackgroundColor 3 = Color 3. new(red,green, 0 ) |
24 | hbar.Size = UDim 2. new( 0 ,(playerhp.Value / maxhealth.Value) * x, 0 ,y) |
please help!