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 » Scripting Helpers
Home Search
 

Re: New body colors on click GUI

Previous Thread :: Next Thread 
calcluth100 is not online. calcluth100
Joined: 02 Nov 2010
Total Posts: 172
15 Sep 2013 01:34 PM
script.Parent.MouseButton1Down:connect(function()
playername = script.Parent.Parent.Parent.Parent.Name
player = Workspace:FindFirstChild(""..playername.."")
if player ~= nil then
     player:FindFirstChild("BodyColors").HeadColor = "Light orange"
    player:FindFirstChild("BodyColors").LeftArmColor = "Light orange"
    player:FindFirstChild("BodyColors").LeftLegColor = "Black"
    player:FindFirstChild("BodyColors").RightArmColor = "Light orange"
    player:FindFirstChild("BodyColors").RightLegColor = "Black"
    player:FindFirstChild("BodyColors").TorsoColor = "Black"
end
end)

What is wrong with this?
Report Abuse
stephen1182 is not online. stephen1182
Joined: 31 Aug 2010
Total Posts: 4003
15 Sep 2013 01:37 PM
Inefficiency.
Report Abuse
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
15 Sep 2013 01:38 PM
BrickColor.new("Light orange")
Report Abuse
calcluth100 is not online. calcluth100
Joined: 02 Nov 2010
Total Posts: 172
15 Sep 2013 01:52 PM
Still doesn't work.
Report Abuse
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
15 Sep 2013 01:56 PM
Insufficient information was given. Sorry, can't help.
Report Abuse
fire243 is not online. fire243
Joined: 04 Apr 2010
Total Posts: 6532
15 Sep 2013 01:57 PM
you need to replace headcolors and stuff like that to BrickColor.new("Place Color Here")
Report Abuse
calcluth100 is not online. calcluth100
Joined: 02 Nov 2010
Total Posts: 172
15 Sep 2013 02:04 PM
script.Parent.MouseButton1Down:connect(function()
playername = script.Parent.Parent.Parent.Parent.Name
player = Workspace:FindFirstChild(""..playername.."")
if player ~= nil then
    player:FindFirstChild("Shirt"):remove()
    player:FindFirstChild("Pants"):remove()
    player:FindFirstChild("ShirtGraphic"):remove()
     player:FindFirstChild("Head").BrickColor.new("Light orange")
    player:FindFirstChild("Left Arm").BrickColor.new("Light orange")
    player:FindFirstChild("Left Leg").BrickColor.new("Black")
    player:FindFirstChild("Right Arm").BrickColor.new("Light orange")
    player:FindFirstChild("Right Leg").BrickColor.new("Black")
    player:FindFirstChild("Torso").BrickColor.new("Black")
end
end)

Like that?
Report Abuse
3rdblox is not online. 3rdblox
Joined: 09 Dec 2012
Total Posts: 4741
15 Sep 2013 02:10 PM
What if there's someone called Part in the game, and you've got a Part in the Workspace? (May not be the problem, but just to tell you...)
Report Abuse
calcluth100 is not online. calcluth100
Joined: 02 Nov 2010
Total Posts: 172
15 Sep 2013 02:13 PM
Nope, not the problem..
Report Abuse
blocco is not online. blocco
Joined: 14 Aug 2008
Total Posts: 29474
15 Sep 2013 02:16 PM
Use localscript
Use local player
stop being inefficient
Report Abuse
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
15 Sep 2013 02:18 PM
player.Torso.BrickColor = BrickColor.new("Black")
Report Abuse
fire243 is not online. fire243
Joined: 04 Apr 2010
Total Posts: 6532
15 Sep 2013 02:31 PM
AND, all those colors are wrong. look at the actual name in studio.
Report Abuse
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
15 Sep 2013 02:32 PM
^The awkward moment when you think you're right but you're wrong... Black and Light orange are valid brick colors.
Report Abuse
calcluth100 is not online. calcluth100
Joined: 02 Nov 2010
Total Posts: 172
15 Sep 2013 02:35 PM
Mhm, they are..I checked in studio ;)
Report Abuse
calcluth100 is not online. calcluth100
Joined: 02 Nov 2010
Total Posts: 172
15 Sep 2013 02:39 PM
Still not working, am i doing something wrong?

script.Parent.MouseButton1Down:connect(function()
local playername = script.Parent.Parent.Parent.Parent.Name --Is it to do with this?
local player = Workspace:FindFirstChild(""..playername.."") --Or this?
if player ~= nil then
    player:FindFirstChild("Shirt"):remove() --Works
    player:FindFirstChild("Pants"):remove() --Works
    player:FindFirstChild("ShirtGraphic"):remove() --Works
    player:FindFirtsChild("Head").face:remove --This doesn't work
     player:FindFirstChild("Head").BrickColor = BrickColor.new("Light orange") --Doesn't work
    player:FindFirstChild("Left Arm")BrickColor.new("Light orange") --Doesn't work
    player:FindFirstChild("Left Leg")BrickColor.new("Black") --Doesn't work
    player:FindFirstChild("Right Arm")BrickColor.new("Light orange") --Doesn't work
    player:FindFirstChild("Right Leg")BrickColor.new("Black") --Doesn't work
    player.Torso.BrickColor = BrickColor.new("Black") --Doesn't work
end
end)
Report Abuse
blocco is not online. blocco
Joined: 14 Aug 2008
Total Posts: 29474
15 Sep 2013 02:42 PM
Dude, do you even code?
Report Abuse
calcluth100 is not online. calcluth100
Joined: 02 Nov 2010
Total Posts: 172
15 Sep 2013 02:43 PM
I try..
Report Abuse
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
15 Sep 2013 02:44 PM
Look at the output, I'm sure that it'll make it clear what's wrong.
Report Abuse
blocco is not online. blocco
Joined: 14 Aug 2008
Total Posts: 29474
15 Sep 2013 02:49 PM
    local player = game.Players.LocalPlayer;
    script.Parent.MouseButton1Down:connect(function()
        player:ClearCharacterAppearance();
        local bodyColors = Instance.new("BodyColors");
        bodyColors.HeadColor = BrickColor.new("Light orange");
        bodyColors.TorsoColor = BrickColor.new("Black");
        bodyColors.LeftArmColor = BrickColor.new("Light orange");
        bodyColors.RightArmColor = BrickColor.new("Light orange");
        bodyColors.LeftLegColor = BrickColor.new("Black");
        bodyColors.RightLegColor = BrickColor.new("Black");
        bodyColors.Parent = player.Character;
    end)
Report Abuse
blocco is not online. blocco
Joined: 14 Aug 2008
Total Posts: 29474
15 Sep 2013 02:52 PM
If you want to be really clean:

    local player, create = game.Players.LocalPlayer, LoadLibrary("RbxUtility").Create;
    script.Parent.MouseButton1Down:connect(function()
        player:ClearCharacterAppearance();
        (Create "BodyColors" {
            HeadColor = BrickColor.new("Light orange");
            TorsoColor = BrickColor.new("Black");
            LeftArmColor = BrickColor.new("Light orange");
            RightArmColor = BrickColor.new("Light orange");
            LeftLegColor = BrickColor.new("Black");
            RightLegColor = BrickColor.new("Black");
        }).Parent = player.Character
    end)
Report Abuse
calcluth100 is not online. calcluth100
Joined: 02 Nov 2010
Total Posts: 172
15 Sep 2013 02:57 PM
THANKYOU!!
Report Abuse
blocco is not online. blocco
Joined: 14 Aug 2008
Total Posts: 29474
15 Sep 2013 03:05 PM
Now, study that code. Realize what makes it work. Realize why the second method I posted didn't work, even though it should have. Realize how you can fix that.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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