Hello, I have a script that sticks stickers with wounds and scratches on a character if his health level drops below a certain amount, but the problem is that this script only works once, and when the stickers disappear, the character’s health is replenished to the maximum and he takes damage again, this action no longer occurs.
I thought the while true do loop would help me solve this problem, but as it turns out, nothing helped.
Please, who can explain to me what is the matter?
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
local human = character:FindFirstChild("Humanoid")
while true do
wait(0.1)
if human.Health <= 20 then
local wound = Instance.new("Decal")
wound.Parent = character.HumanoidRootPart
wound.Texture = "http://www.roblox.com/asset/?id=166075812"
wound.Face = "Front"
wound.Name = "WoundInTorso"
local bf = Instance.new("Decal")
bf.Parent = character.Head
bf.Texture = "http://www.roblox.com/asset/?id=1253120824"
bf.Face = "Front"
bf.Name = "BloodInFace"
character.Humanoid.WalkSpeed = character.Humanoid.WalkSpeed - 13
local tbc = Instance.new("Sound")
tbc.Parent = character.HumanoidRootPart
tbc.Volume = 1
tbc.SoundId = "rbxassetid://664619535"
tbc:Play()
wait(10)
character.Humanoid.WalkSpeed = character.Humanoid.WalkSpeed + 13
character.HumanoidRootPart.WoundInTorso:Destroy()
character.Head.BloodInFace:Destroy()
character.HumanoidRootPart.Tbc:Destroy()
end
end
end)
end)
In other words, I would like to know how to get the above script to run constantly, without having to reset the character.