I have a simple script that is supposed to turn a player's skin tone to light blue.
hit.Parent["Body Colors"]:Destroy() for i,v in pairs(hit.Parent:GetChildren()) do if v.ClassName == "Part" then v.BrickColor = BrickColor.new("Light blue") end end
"hit" represents a limb, so hit.Parent is the character's model. For some reason it only does it to one part.
I am a bit rusty, so this may or may not work, but in my own experience I had to go do each individual body part when I wanted to change skin color/ material color/ transparency.
hit.Parent['Body Colors']:Destroy() -- Destroys Body Colors for _,v in pairs(hit.Parent:GetChildren()) do -- Turns v into all Children of Parent if v.ClassName == "Part" then -- Checks to see if the Childrens class is "Part" v.BrickColor = BrickColor.new("Light blue") -- Tries to turn all children with classname "part" to color Light blue end end
I am terrible at explaining what you did wrong, so let me see if I can come up with a solution. Remember I am rusty to high h*ll so forgive me.
hit.Parent['Body Colors':Destroy() for _,v in pairs(hit.Parent:GetChildren()) do if v.ClassName == "Part" then v["Left Leg"].BrickColor = BrickColor.new("Light blue") v["Right Leg"].BrickColor = BrickColor.new("Light blue") v["Left Arm"].BrickColor = BrickColor.new("Light blue") v["Right Arm"].BrickColor = BrickColor.new("Light blue") v["Torso"].BrickColor = BrickColor.new("Light blue") v["Head"].BrickColor = BrickColor.new("Light blue") end end end
This may or may not work, like I said I am pretty rusty.
script.Parent.Touched:Connect(function(hit) hit.Parent:FindFirstChild("Body Colors"):Remove() for _,ctype in pairs(hit.Parent:GetChildren()) do -- ctype stands for class type if ctype:IsA("Part") then ctype.BrickColor = BrickColor.new("Light blue") end end end)