Help with Kill Script

image

Whenever I touch the part, it says BodyColors is not a valid member of (my username).

Also if possible, can someone help me scan the player’s entire body color, not just the torso? It’s important.

1 Like

It said that bc it thinks the BodyColors your refering as is a part in side the player.

So how do I inform it that I mean the property, not a part?

The player is a model and no model have that property.

Are you saying no player has a property called “BodyColors”? If so, thats false.

I’m not really known for models but if im wrong then don’t use (“FindFirstChild”)

Even though it’s not a part, it’s still a child if I’m correct. Therefore I can still use findfirstchild.

1 Like

Can you screen shot it? So i can know.

image

1 Like

Theres a space between the name.

1 Like

Write (“Body Colors”) instead. Because theres no part that named “BodyColors”

1 Like
local part = script.Parent

part.Touched:Connect(function(Object)
    if not Object.Parent:FindFirstChild("Humanoid") then return end
    local SkinColors = Object.Parent["Body Colors"]
    if SkinColors.TorsoColor == BrickColor.new("Dark Brown") then
        Object.Parent.Humanoid.Health = 0
    end
end)

Quick Problem… How do I reference an object with 2 words?

FindFirstchild(“Body Colors”). You should write that instead of that but if you still wanna do that then write

if plrpart.Parent["Body Colors"]

I have that down already, but I need to reference it later in the script, How do I reference a 2 worded object?

I guess another problem arose, this is my new script:
image

error is the same as the first error.

then use plrpart.Parent[“Body Colors”] then.

No error this time. Looking good so far.

And i would suggest write this instead:

if skintones.TorsoColor == "Dark Brown"
1 Like

Because you already defind the skintones if you write it like what you write then it would be :

if plrpart.Parent.plrpart.Parent:FindFirstChild("Body Colors").TorsoColor == "Dark Brown"