I'm trying to make a script so that when you get hurt your face changes for a little time, but I can't get it work. The script is a script inside StarterCharacterScripts, and It's the following:
local previousface = script.Parent.Head.face.Texture
local humanoidhealth = script.Parent.Humanoid.Health
if humanoidhealth > script.Parent.Humanoid.Health then
script.parent.Head.face.Texture = "rbxassetid://732910174"
wait (0.5)
script.parent.Head.face.Texture = previousface
local humanoidhealth = script.Parent.Head.face.Texture
end
if humanoidhealth < script.Parent.Humanoid.Health then
local humanoidhealth = script.Parent.Humanoid.Health
end
I can't get what's wrong. The first if then is for changing the face when you get hurt. The second one is for setting humanoidhealth to the humanoids health if it rehealhs.
Help!

2 comments
Hi! works fine! Thank you!
PD: I added "and newhealth ~= 0" because I have another script that sets the face to a different one on death.