✓ Accepted answer
I believe your problem here is that the script only checks the player's health once. What you need is a Changed event. Also, you should try implementing what thesit123 said in his answer as well, as that is another problem you have with your script. Basically, a Changed event is fired whenever a property of an Instance is changed. In your case, you want to check the health of the player, so your script would read something like this:
local PainText = script.Parent
local Human = script:FindFirstChild("Humanoid")
Human.Changed:Connect(function()
if Human.Health < 90 then
PainText.Text = "BRUISED"
elseif Human.Health > 90 then
PainText.Text = "HEALTHY"
end
end)
If you need more information on Changed events, visit this ROBLOX Wiki page:
http://wiki.roblox.com/index.php?title=API:Class/Instance/Changed
Hope this helps! If it does, please accept my answer!
EDIT: I just realized that incapaz answered the question before I did while I was typing the answer. So technically, he answered before I did. He also used a function I haven't even heard of, which is most likely more efficient than the one I used. Well played, man. Well played.
2 comments
Change Human. The Humanoid isn't going to be inside the script
its a local script