Changing a players skin color

I need to change a players skin color, but the script i wrote wasn’t working, it only works half the time. So I was thinking of writing it like this:

        local t = 0--current tries
		local mt = 7--max tries
		repeat
			char["Torso"].BrickColor = BrickColor.new("Really black")
			t += 1
		until mt

instead of simply writing it like this, because like i said before it was only working half the time.

char["Torso"].BrickColor = BrickColor.new("Really black")

so will the new way i wrote it work? (the first block of code)

1 Like

You can Set the Basepart’s Of the Character’s Color.
Try This Script in ServerScriptService.
This should work Smoothly, I just Tested it on A Baseplate.

game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		local function SetColor(BasePart)
            if not BasePart:IsA("BasePart") then return end
            BasePart.Color=Color3.fromRGB(0,0,0) -- Black Color
        end
        for i, v in pairs(Character:GetChildren()) do SetColor(v) end
        Character.ChildAdded:Connect(SetColor)
	end)
end)
3 Likes

“7” is the same as true, you need to make a comparison.

until t == mt or char["Torso"].BrickColor == "Really black"
2 Likes

I think WaitForChild is better instead of a loop

1 Like