so when i have less than 30 health or 30 the text appears like a warning for low health, and when i increase the health more than 30 the text still appears, there is no errors nor warnings
here script:
local plr = game.Players.LocalPlayer
local char = plr.Character
local hum = char:FindFirstChildOfClass("Humanoid")
hum.HealthChanged:Connect(function(hlth)
if hlth <= 30 then
while wait() do
script.Parent.Visible = true
wait(0.5)
script.Parent.Visible = false
wait(0.5)
end
else
script.Parent.Visible = false
end
end)
There is definitely a better way to achieve the effect you’re going for, but if you just want to fix the issue, try this:
local plr = game.Players.LocalPlayer
local char = plr.Character
local hum = char:FindFirstChildOfClass("Humanoid")
hum.HealthChanged:Connect(function(hlth)
if hlth <= 30 then
while wait() do
script.Parent.Visible = true
wait(0.5)
script.Parent.Visible = false
wait(0.5)
if hum.Health > 30 then
script.parent.Visible = true
break
end
end
else
script.Parent.Visible = false
end
end)