Here is the code:
Textures = "rbxassetid://6041158202", "rbxassetid://2078208894", "rbxassetid://247766282"
script.Parent.Humanoid.HealthChanged:Connect(function()
if script.Parent.Humanoid.Health <= math.random(0, 100) then --ignore
Instance.new("Decal", script.Parent["Left Leg"])
script.Parent["Left Leg"].Decal.Texture = math.random(0, #Textures) --ignore
script.Parent["Left Leg"].Decal.Face = Region3int16
end
end)
For some reason it gives me the error, “Assigning 3 to 1 Variables will leave some variables unused.”
Any help is great!
Forummer
(Forummer)
February 12, 2022, 7:42pm
#2
Textures = {"rbxassetid://6041158202", "rbxassetid://2078208894", "rbxassetid://247766282"}
Just missing the table constructors.
Feeling massively stupid. Thanks lol
Sorry to bother again but now my script just dosen’t work at all>? (Didn’t work before but I am confused)
1 Like
Forummer
(Forummer)
February 12, 2022, 7:51pm
#5
local Character = script.Parent
local Humanoid = Character:WaitForChild("Humanoid")
local LeftLeg = Character:WaitForChild("Left Leg")
Textures = {"rbxassetid://6041158202", "rbxassetid://2078208894", "rbxassetid://247766282"}
Humanoid.HealthChanged:Connect(function()
local Decal = Instance.new("Decal")
Decal.Texture = Textures[math.random(#Textures)]
Decal.Parent = LeftLeg
end)
1 Like
Epixerty
(epix)
February 12, 2022, 7:53pm
#6
I’m not too sure but I think its math.random(#Textures)
, not math.random(0, #Textures)
Every time the person is hit, It creates a new decal, and changes the texture, Which makes it switch the texture every time the character is hit.
Forummer
(Forummer)
February 12, 2022, 8:07pm
#8
What behavior are you intending to achieve?
On player hit, Create a blood texture, Which stays until despawn (When character is destroyed.) But when player is hit, It creates a texture, But when hit again (When not dead) It creates another texture and destroys the other one.
Blood is seen, Don’t Watch if your not blood comfortable.
(Video may not work)
Forummer
(Forummer)
February 12, 2022, 8:26pm
#10
Humanoid.HealthChanged:Connect(function()
if LeftLeg:FindFirstChild("Decal") then
return
end
local Decal = Instance.new("Decal")
Decal.Texture = Textures[math.random(#Textures)]
Decal.Parent = LeftLeg
end)
1 Like