generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Changing Character Body Colors

Previous Thread :: Next Thread 
LeikaZ is not online. LeikaZ
Joined: 31 Jan 2008
Total Posts: 595
14 Feb 2016 01:20 PM
Why doesn't it work? Output doesn't show any errors.

local Players = game:GetService("Players")

function onPlayerAdded(player)
repeat wait() until player.Character
player.Character.Head.BrickColor = BrickColor.new("Pastel brown")
player.Character.Torso.BrickColor = BrickColor.new("Pastel brown")
player.Character:FindFirstChild("Right Arm").BrickColor = BrickColor.new("Pastel brown")
player.Character:FindFirstChild("Left Arm").BrickColor = BrickColor.new("Pastel brown")
player.Character:FindFirstChild("Left Leg").BrickColor = BrickColor.new("Pastel brown")
player.Character:FindFirstChild("Right Leg").BrickColor = BrickColor.new("Pastel brown")

Players.PlayerAdded:connect(onPlayerAdded)


Report Abuse
LeikaZ is not online. LeikaZ
Joined: 31 Jan 2008
Total Posts: 595
14 Feb 2016 01:21 PM
Is there any other way to change body colors?


Report Abuse
cheesecake123456 is not online. cheesecake123456
Joined: 01 Jun 2009
Total Posts: 1529
14 Feb 2016 01:26 PM
game.Players.PlayerAdded:connect(function(plyr)
plyr.CharactedAdded:connect(function()
for _, v in pairs(plyr.Character:GetChildren()) do
if v:IsA('Part') then
v.BrickColor = BrickColor.new('Pastel Brown')
end
end
end)
end)


Report Abuse
LeikaZ is not online. LeikaZ
Joined: 31 Jan 2008
Total Posts: 595
14 Feb 2016 01:38 PM
@cheesecake CharactedAdded is not a valid member of Player


Report Abuse
Protoduction is not online. Protoduction
Joined: 27 Jul 2012
Total Posts: 1054
14 Feb 2016 01:41 PM
What the heck is CharactedAdded?

I'd go with

game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(char)
coroutine.resume(coroutine.create(function()
wait(0.5)
for i,v in pairs(char:GetChildren()) do
if v:IsA("BasePart") then
v.BrickColor = BrickColor.new("Pastel brown")
end
end
end))
end)
end)


-____________________________-
Report Abuse
LeikaZ is not online. LeikaZ
Joined: 31 Jan 2008
Total Posts: 595
14 Feb 2016 01:43 PM
lol didin't notice


Report Abuse
LeikaZ is not online. LeikaZ
Joined: 31 Jan 2008
Total Posts: 595
14 Feb 2016 01:44 PM
I don't know why, but my body colors doesn't change when I use both scripts


Report Abuse
Protoduction is not online. Protoduction
Joined: 27 Jul 2012
Total Posts: 1054
14 Feb 2016 01:44 PM
Also, cheesecake, you should read up on what functions return. You use

plyr.Character

in your for loop, while you could just do

plyr.CharacterAdded:connect(function(char)
for i,v in pairs(char:GetChildren())




-____________________________-
Report Abuse
LeikaZ is not online. LeikaZ
Joined: 31 Jan 2008
Total Posts: 595
14 Feb 2016 01:45 PM
Forgot to mention: no errors. :/


Report Abuse
Protoduction is not online. Protoduction
Joined: 27 Jul 2012
Total Posts: 1054
14 Feb 2016 01:45 PM
Are you using a serverside script?
Is FilteringEnabled on?
If your on a localscript are you running in a client?


-____________________________-
Report Abuse
LeikaZ is not online. LeikaZ
Joined: 31 Jan 2008
Total Posts: 595
14 Feb 2016 01:48 PM
Script - Not local (serverside) I guess
FE - Off

I use studio's "Play" mode


Report Abuse
Protoduction is not online. Protoduction
Joined: 27 Jul 2012
Total Posts: 1054
14 Feb 2016 01:49 PM
Does it work in game?


-____________________________-
Report Abuse
LeikaZ is not online. LeikaZ
Joined: 31 Jan 2008
Total Posts: 595
14 Feb 2016 01:51 PM
so apparently it doesn't work in "Play Solo"



Thanks.


Report Abuse
Protoduction is not online. Protoduction
Joined: 27 Jul 2012
Total Posts: 1054
14 Feb 2016 01:58 PM
Fixed it. The Body Colors Instance was overwriting changes made the characters body color, as the changes were made before it was added to the character. This should work now.

game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(char)
local bodyColors = char:WaitForChild("Body Colors")
bodyColors.Parent = nil
for i,v in pairs(char:GetChildren()) do
if v:IsA("BasePart") and v.Name ~= "HumanoidRootPart" then
v.BrickColor = BrickColor.new("Pastel brown")
print(v.Name)
end
end
end)
end)

That should work now.


-____________________________-


-____________________________-
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image