when my health reach (the humanoid Health/4) or 25 in this case

the Heath bar does not seem to blink red and white/…. it just stays white

can I please have some help please?????

here is the script. on lines 18 - 34 it should blink on the event when you health is low....

what is wrong now?

local play = game.Players.LocalPlayer
local char = play.Character 
local hum = char:WaitForChild("Humanoid")
local shp = char:WaitForChild("ShieldPoints")
local maxshp = shp:WaitForChild("MaxShieldPoints")
local inuse = false
local lowerlayeer = script.Parent
local barholder = script.parent.Parent				
function Onchanged() 
	local HealthValue = hum.Health/hum.MaxHealth
	lowerlayeer.Size = UDim2.new(HealthValue,0,1,0)
end

Onchanged()

hum.Changed:Connect(Onchanged)

hum.Changed:Connect(function()
	if hum.Health <= hum.Health/4 then
		if inuse == true then
		return end
	
		while true do 
		
		if hum.Health > hum.Health/4 then
			inuse = true
			barholder.BackgroundColor3 = Color3.new(255,255,255)
			break
		end
		wait(.5)
		print("hi")
		barholder.BackgroundColor3 = Color3.new(255,00)
		wait(.5)
		barholder.BackgroundColor3 = Color3.new(255,255,255)
		end
	end
	
	
end)

4 comments

1

Ok so lets look at line 19. Lets say the human has a health value of 100. if health(100) is less than or equal to health/4 (100 / 4 = 25) then proceed. This statement will never be true, and never proceed.

0

oh huh Why?

0

You meant to write Humanoid.MaxHealth not Humanoid.Health

0

OOOHHHH OK now thank you ahahh LOL XD!