I have a simple script that is supposed to turn a player's skin tone to light blue.
1 | hit.Parent [ "Body Colors" ] :Destroy() |
2 | for i,v in pairs (hit.Parent:GetChildren()) do |
3 | if v.ClassName = = "Part" then |
4 | v.BrickColor = BrickColor.new( "Light blue" ) |
5 | end |
6 | 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.
1 | hit.Parent [ 'Body Colors' ] :Destroy() -- Destroys Body Colors |
2 | for _,v in pairs (hit.Parent:GetChildren()) do -- Turns v into all Children of Parent |
3 | if v.ClassName = = "Part" then -- Checks to see if the Childrens class is "Part" |
4 | v.BrickColor = BrickColor.new( "Light blue" ) -- Tries to turn all children with classname "part" to color Light blue |
5 | end |
6 | 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.
01 | hit.Parent [ 'Body Colors' :Destroy() |
02 | for _,v in pairs (hit.Parent:GetChildren()) do |
03 | if v.ClassName = = "Part" then |
04 | v [ "Left Leg" ] .BrickColor = BrickColor.new( "Light blue" ) |
05 | v [ "Right Leg" ] .BrickColor = BrickColor.new( "Light blue" ) |
06 | v [ "Left Arm" ] .BrickColor = BrickColor.new( "Light blue" ) |
07 | v [ "Right Arm" ] .BrickColor = BrickColor.new( "Light blue" ) |
08 | v [ "Torso" ] .BrickColor = BrickColor.new( "Light blue" ) |
09 | v [ "Head" ] .BrickColor = BrickColor.new( "Light blue" ) |
10 | end |
11 | end |
12 | end |
This may or may not work, like I said I am pretty rusty.
1 | script.Parent.Touched:Connect( function (hit) |
2 | hit.Parent:FindFirstChild( "Body Colors" ):Remove() |
3 | for _,ctype in pairs (hit.Parent:GetChildren()) do -- ctype stands for class type |
4 | if ctype:IsA( "Part" ) then |
5 | ctype.BrickColor = BrickColor.new( "Light blue" ) |
6 | end |
7 | end |
8 | end ) |