Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

My change skin color script is broken...(Still Not working) Solution?

Asked by
mxpvjn 75
8 years ago
Edited 8 years ago

I just makes me yellow...

script.Parent.Touched:connect(function(part)
    player = part.Parent
    if player.Head.BrickColor ~= ("Bright yellow") then
        print("changed to crusty")
        player = part.Parent
        player.Head.BrickColor = BrickColor.new("Bright yellow")
        player.Torso.BrickColor = BrickColor.new("Bright yellow")
        player["Left Arm"].BrickColor = BrickColor.new("Bright yellow")
        player["Left Leg"].BrickColor = BrickColor.new("Bright yellow")
        player["Right Leg"].BrickColor = BrickColor.new("Bright yellow")
        player["Right Arm"].BrickColor = BrickColor.new("Bright yellow")
    elseif player.Head.BrickColor == ("Bright yellow") then
        player.Head.BrickColor = BrickColor.new("Bright green")
        player.Torso.BrickColor = BrickColor.new("Bright green")
        player["Left Arm"].BrickColor = BrickColor.new("Bright green")
        player["Left Leg"].BrickColor = BrickColor.new("Bright green")
        player["Right Leg"].BrickColor = BrickColor.new("Bright green")
        player["Right Arm"].BrickColor = BrickColor.new("Bright green")
    end 
end)

1 answer

Log in to vote
1
Answered by 8 years ago
Edited 8 years ago

EDIT: Updated.

Hello!

The issue is that roblox has a system for coloring characters, wich is held in an instance called Body Colors.

To fix this, right on the beggining of your script, you must remove them. For this do

player:WaitForChild('Body Colors'):Destroy()

You are also doing a common mistake. BrickColors aren't strings!!! Therefore, you must do BrickColor.new(Colour) instead.

This would be your script:

script.Parent.Touched:connect(function(part)
    player = part.Parent
    if player.Head.BrickColor ~= BrickColor.new("Bright yellow") then
        print("changed to crusty")
        player = part.Parent
    player:WaitForChild('Body Colors'):Destroy()
        player.Head.BrickColor = BrickColor.new("Bright yellow")
        player.Torso.BrickColor = BrickColor.new("Bright yellow")
        player["Left Arm"].BrickColor = BrickColor.new("Bright yellow")
        player["Left Leg"].BrickColor = BrickColor.new("Bright yellow")
        player["Right Leg"].BrickColor = BrickColor.new("Bright yellow")
        player["Right Arm"].BrickColor = BrickColor.new("Bright yellow")
    elseif player.Head.BrickColor == BrickColor.new("Bright yellow") then
        player.Head.BrickColor = BrickColor.new("Bright green")
        player.Torso.BrickColor = BrickColor.new("Bright green")
        player["Left Arm"].BrickColor = BrickColor.new("Bright green")
        player["Left Leg"].BrickColor = BrickColor.new("Bright green")
        player["Right Leg"].BrickColor = BrickColor.new("Bright green")
        player["Right Arm"].BrickColor = BrickColor.new("Bright green")
    end 
end)

0
Still Now working mxpvjn 75 — 8y
0
Oh sorry! Found a bug! marcoantoniosantos3 200 — 8y
Ad

Answer this question