Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why won't this decal appear on the localplayers torso?

So I'm trying to make a decal appear on a localplayers torso (Wound is the decal) when their health is 99 or below. The error is saying "Torso is not a valid member of Player" and I'm unsure why it is doing this. Yes, the game is in R6 so it's not the problem of me not putting something like "Uppertorso" instead. May anyone give me a fixed version or at least tell me what I have done wrong? Thank you!

local Humanoid = script.Parent.Humanoid

Humanoid.HealthChanged:Connect(function(Health)
	if Health <= 99 then
		game.Workspace.DM:Stop()
		game.Workspace.Wound:Clone()
		game.Workspace.Wound.Parent = game.Players.LocalPlayer.Torso
		game.Workspace.Autophobia:Play()
		script:Destroy()
	end
end)

1 answer

✓ Accepted answer

I will return a fixed version of your script and explain where you've gone wrong on each line.

local Humanoid = script.Parent.Humanoid	 
Humanoid.HealthChanged:Connect(function(Health)
	if Health <= 99 then
		game.Workspace.DM:Stop()
		local clone = game.Workspace.Wound:Clone()
		clone.Parent = game.Players.LocalPlayer.Character.Torso
		game.Workspace.Autophobia:Play()
		script:Destroy()
	end
end)

Your first error was on line 7. You didn't change the parent of the clone, you changed the parent of the original copy.

Your second error was also on line 7, instead of game.Players.LocalPlayer.Character.Torso, you missed out the .Character.

If you find this answer helpful please consider this an answer.

This discussion is preserved as it was. New answers, comments, and votes are closed.