Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Help with health bar?

i need some help With this custom Health bar something went wrong i do not know what help me

local Char = workspace:FindFirstChild(script.Parent.Parent.Parent.Character)
hum = Char.Humanoide
hum.Changed:connect(function()
	script.Parent.Frame.Health.Frame.Size = Udim2.new(hum.Health/hum.MaxHealth,0,1,0)
	script.Parent.Frame.potet.TextLabel.Text = ""..hum.Health.."/"..hum.MaxHealth..""
	if hum.Health <= hum.MaxHealth*0.15 then
		script.Parent.Frame.Health.Frame.BackgroundColor3 = Color3.new = (139,0,0)
	else
		script.Parent.Frame.Health.Frame.BackgroundColor3 = Color3.new = (213,5,5)
		
	end
end)

1 comment

0

Output? F9?

1 answer

local Char = workspace:FindFirstChild(script.Parent.Parent.Parent.Character)
hum = Char.Humanoide
hum.Changed:connect(function()
    script.Parent.Frame.Health.Frame.Size = Udim2.new(hum.Health/hum.MaxHealth,0,1,0)
    script.Parent.Frame.potet.TextLabel.Text = ""..hum.Health.."/"..hum.MaxHealth..""
    if hum.Health <= hum.MaxHealth*0.15 then
        script.Parent.Frame.Health.Frame.BackgroundColor3 = Color3.new (139,0,0)--incorrect format
    else
        script.Parent.Frame.Health.Frame.BackgroundColor3 = Color3.new(213,5,5)--incorrect format

    end
end)

1 comment

0

Explain the problem, also Color3's need to be in decimals so divide the values by 255.

This discussion is preserved as it was. New answers, comments, and votes are closed.