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

Changing player color?

Asked by 9 years ago

I want to know the procedures of changing a player's colors or adding a decal onto them to make clothes. NOTE: I don't want a script (although I still would take it) because that is not what I am asking for.

1 answer

Log in to vote
0
Answered by
BlackJPI 2658 Snack Break Moderation Voter Community Moderator
9 years ago

There are a couple of ways to change the player's colours. One way, is the change the colours that are in the Player's BodyColors object. This will change the colour of the designated bodypart and make sure they stay changed.

local bodycolors = game.Players.Player.Character.BodyColors

repeat wait() until bodycolors
BodyColors.HeadColor = BrickColor.new('Bright blue')
BodyColors.HeadColor = BrickColor.new('Bright green')

Another way to do this is to use a loop to get all of the parts in the character, and change their colour directly.

local character = game.Players.Player.Character

repeat wait() until character
for _, bodypart in ipairs (character:GetChildren()) do
    if bodypart.Name == 'Head' then
        bodypart.BrickColor = BrickColor.new('White')
    elseif bodypart.Name == 'Torso' then
        bodypart.BrickColor = BrickColor.new('Bright red')
    end
end

For adding a decal, you would use the method Instance.new to create the decal object and from there set it's Image and face properties.

local character = game.Players.Player.Character

repeat wait() until character
local decal = Instance.new('Decal', character)
decal.Image = 'http://roblox.com/asset/?id=1337'

Hope this helped :)

Ad

Answer this question