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
11 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
11 years ago

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

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

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

01bodyColors = {'HeadColor', 'LeftArmColor', 'LeftLegColor', 'RightArmColor', 'RightLegColor', 'TorsoColor'}
02 
03 
04game:GetService('Players').PlayerAdded:connect(function(player)
05    player.CharacterAdded:connect(function(char)
06        for _,color in pairs(bodyColors) do
07            char["Body Colors"][color] = BrickColor.new("Institutional white")
08        end
09    end)
10end)

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

01bodyParts = {'Head', 'Left Arm', 'Left Leg', 'Right Arm', 'Right Leg', 'Torso'}
02 
03 
04game:GetService('Players').PlayerAdded:connect(function(player)
05    player.CharacterAdded:connect(function(char)
06        for _,part in pairs(bodyParts) do
07            char[part].BrickColor = BrickColor.new("Institutional white")
08        end
09    end)
10end)

~coo1o

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

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

1Game.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 — 11y
Log in to vote
0
Answered by
Kratos232 105
11 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:

01Plrs = Game:GetService("Players")
02Plrs.PlayerAdded:connect(function(Plr)
03    Plr.CharacterAdded:connect(function(Char)
04        for i, v in pairs(Char:GetChildren()) do
05            if v:IsA("Part") then
06                v.BrickColor = BrickColor.new("Institutional white")
07            end
08        end
09    end)
10end)

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

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

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

01function onPlayerEntered
02    player.CharacterAdded:connect(function(char)
03        while wait(0) do
04            Game.Workspace.Character.Torso.BrickColor.new = ("Institutional white")
05Game.Workspace.Character.LeftArm.BrickColor.new = ("Institutional white")
06Game.Workspace.Character.RightArm.BrickColor.new = ("Institutional white")
07Game.Workspace.Character.Head.BrickColor.new = ("Institutional white")
08Game.Workspace.Character.LeftLeg.BrickColor.new = ("Institutional white")
09Game.Workspace.Character.RightLeg.BrickColor.new = ("Institutional white")
10        end
11    end)
12end
13 
14game.Players.PlayerAdded:connect(onPlayerEntered)

Answer this question