I've been making a game where when you reach say, 75 health or less, blood will appear. Here is the script:
if script.Parent.Parent:WaitForChild("Humanoid").Health == 0 then script.Parent.Parent.Knife.Transparency = 0 end if script.Parent.Parent:WaitForChild("Humanoid").Health <= 25 then script.Parent.Parent.Blood.Decal.Transparency = 0 script.Parent.Parent.Blood.Decal2.Transparency = 0 end if script.Parent.Parent:WaitForChild("Humanoid").Health <= 75 then script.Parent.Parent.Blood2.Decal.Transparency = 0 end
You can use the event "Health Changed" instead of making a if then statement first.
Here is a format:
script.Parent.Parent:WaitForChild("Humanoid").HealthChanged:Connect(function(health) if health == 0 then -- put what health you want to detect here --code here end end)
Tell me if this works, try it!
Try this
script.Parent.Parent:WaitForChild("Humanoid").Changed:Connect(function() --This detects whenever something in the humanoid changes if script.Parent.Parent:WaitForChild("Humanoid").Health == 0 then script.Parent.Parent.KnifeTransparency = 0 end end) script.Parent.Parent:WaitForChild("Humanoid").Changed:Connect(function() if script.Parent.Parent:WaitForChild("Humanoid").Health <= 25 then script.Parent.Parent.Blood.Decal.Transparency = 0 script.Parent.Parent.Blood.Decal2.Transparency = 0 end end) script.Parent.Parent:WaitForChild("Humanoid").Changed:Connect(function() if script.Parent.Parent:WaitForChild("Humanoid").Health <= 75 then script.Parent.Parent.Blood2.Decal.Transparency = 0 end end)