Hi, I am trying to make a blood/gore script for my friend to use, and something's not working. Could you give me any advice?
if script.Parent.Humanoid.Health <= 92 then script.Parent["Left Leg"].Instance.new("Decal") script.Parent["Left Leg"].Decal.Texture = "http://www.roblox.com/asset/?id=508050906" script.Parent["Left Leg"].Decal.Face = Region3int16 end
(The script is supposed to be in StarterCharacterScripts)
Like Ziffixture said, You can use Humanoid.HealthChanged
to detect when your health is low
local Humanoid = script.Parent.Humanoid -- Get the humanoid local GoreDecal -- Localize GoreDecal Humanoid.HealthChanged:Connect(function(Health) if Health <= 92 then -- script.Parent["Left Leg"].Instance.new("Decal") is wrong, replace with GoreDecal = Instance.new("Decal", script.Parent["Left Leg"]) -- which makes a new decal and sets it GoreDecal.Texture = "rbxassetid://508050906" -- Use rbxassetid:// GoreDecal.Face = Region3int16 end end)
But I have one question. Why would you set the decal's face to Region3int16?
Well, the easiest answer for your question is to add a while
loop to check the loop in intervals.
while wait() do -- Loops the code 33 times a sec if script.Parent.Humanoid.Health <= 92 then script.Parent["Left Leg"].Instance.new("Decal") script.Parent["Left Leg"].Decal.Texture = "http://www.roblox.com/asset/?id=508050906" script.Parent["Left Leg"].Decal.Face = Region3int16 end end
Lemme know if it helps!