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

Changing Body Colors

Asked by
BLUUAH 20
10 years ago

So I want to Change my body color, but i keep getting confused when trying to label the BodyParts, or If I'm susposed to use "Larm" as a Variable or something.

My Scripting Knowledge is Limited, and LuaLearners is Down.....This doesn't go well.

Im trying to change it to "Institutional white"

4 answers

Log in to vote
1
Answered by
coo1o 227 Moderation Voter
10 years ago

Here's a nice dealio using a table and the Body Colors object of character models.

bodyColors = {'HeadColor', 'LeftArmColor', 'LeftLegColor', 'RightArmColor', 'RightLegColor', 'TorsoColor'}
for _,color in pairs(bodyColors) do
    workspace.Player1["Body Colors"][color] = BrickColor.new("Institutional white")
end

You can use the PlayerAdded event and the CharacterAdded event to make a character's body Institution white everytime they respawn.

bodyColors = {'HeadColor', 'LeftArmColor', 'LeftLegColor', 'RightArmColor', 'RightLegColor', 'TorsoColor'}


game:GetService('Players').PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(char)
        for _,color in pairs(bodyColors) do
            char["Body Colors"][color] = BrickColor.new("Institutional white")
        end
    end)
end)

Though there may be some cases that a character won't have the Body Colors object so this may work.

bodyParts = {'Head', 'Left Arm', 'Left Leg', 'Right Arm', 'Right Leg', 'Torso'}


game:GetService('Players').PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(char)
        for _,part in pairs(bodyParts) do
            char[part].BrickColor = BrickColor.new("Institutional white")
        end
    end)
end)

~coo1o

Ad
Log in to vote
1
Answered by
wddd89 35
10 years ago

Well, it's pretty easy. Which body part do you want to change, though? we'll go for torso for now.

Game.Workspace.Name.Torso.BrickColor = BrickColor.new("Institutional white") --turn "name" into your name

0
Thanks, This helped me alot. but I was trying to change the Entire Body Color to "Institutional white". Do you just keep Repeating the same line? BLUUAH 20 — 10y
Log in to vote
0
Answered by
Kratos232 105
10 years ago

Here's a little script I made just for you. I hope it works. I just kinda wrote this in Notepad, but it should work, it's not that complex.

Script:

Plrs = Game:GetService("Players")
Plrs.PlayerAdded:connect(function(Plr)
    Plr.CharacterAdded:connect(function(Char)
        for i, v in pairs(Char:GetChildren()) do
            if v:IsA("Part") then
                v.BrickColor = BrickColor.new("Institutional white")
            end
        end
    end)
end)

Well I hope it works... Tell me if there's an error.

  • Kratos232
Log in to vote
-1
Answered by
BLUUAH 20
10 years ago

I came up with this script. But i think it's not going to work.

function onPlayerEntered
    player.CharacterAdded:connect(function(char)
        while wait(0) do
            Game.Workspace.Character.Torso.BrickColor.new = ("Institutional white")
Game.Workspace.Character.LeftArm.BrickColor.new = ("Institutional white")
Game.Workspace.Character.RightArm.BrickColor.new = ("Institutional white")
Game.Workspace.Character.Head.BrickColor.new = ("Institutional white")
Game.Workspace.Character.LeftLeg.BrickColor.new = ("Institutional white")
Game.Workspace.Character.RightLeg.BrickColor.new = ("Institutional white")
        end
    end)
end 

game.Players.PlayerAdded:connect(onPlayerEntered)

Answer this question