"Assigning 3 to 1 Variables will leave some variables unused"

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!

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
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

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.

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)

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