Help with Kill Script and Part

image

No errors and such, but my character has a Medium Brown torso on and I still won’t die.

Help?

local part = script.Parent

part.Touched:Connect(function(playerPart)
	local humanoid = playerPart.Parent:FindFirstChild('Humanoid')
	local bodyColors = playerPart.Parent:FindFirstChild('Body Colors')
	if humanoid and bodyColors and bodyColors.TorsoColor.Name == 'Medium stone grey' then
		humanoid.Health = 0
	end
	humanoid = nil
	bodyColors = nil
end)

You’ll need to use .Name to get the actual string name. Same goes for any BrickColor.

2 Likes

I used TorsoColor.Name, though it still won’t kill me when I step on it. I do have the colored torso on.

use .Value instead of .Name

local part = script.Parent

part.Touched:Connect(function(playerPart)
local humanoid = playerPart.Parent:FindFirstChild(‘Humanoid’)
local bodyColors = playerPart.Parent:FindFirstChild(‘Body Colors’)
if humanoid and bodyColors and bodyColors.TorsoColor.Value == ‘Medium stone grey’ then
humanoid.Health = 0
end
humanoid = nil
bodyColors = nil
end)

In addition to the other suggestions ‘Medium Brown’ should be ‘Medium brown’.

2 Likes

That was the last straw to the solution. Thank you so much, I keep my original script but changed “Brown” to a lower case “brown”. Everything works.