I have made me a gui script. You are able to press on a textbutton and it changes the color of you whole body FOR ONLY ME! It seems to be working right but not working for other people. They say something is wrong w/ it.
color1 = 1 function color() script.Parent.Parent.Parent.Parent.Parent.Character["Head"].BrickColor = BrickColor.new(color1) script.Parent.Parent.Parent.Parent.Parent.Character["Torso"].BrickColor = BrickColor.new(color1) script.Parent.Parent.Parent.Parent.Parent.Character["Left Arm"].BrickColor = BrickColor.new(color1) script.Parent.Parent.Parent.Parent.Parent.Character["Right Arm"].BrickColor = BrickColor.new(color1) script.Parent.Parent.Parent.Parent.Parent.Character["Left Leg"].BrickColor = BrickColor.new(color1) script.Parent.Parent.Parent.Parent.Parent.Character["Right Leg"].BrickColor = BrickColor.new(color1) end script.Parent.MouseButton1Down:connect(color)
I always accept answers!
The problem is that characters have a BodyColors instance in them which overrides the BrickColor property of the parts of the character.
What you want to do is instead of editing the part's BrickColor, you want to edit BodyColors and it's necessary properties so ROBLOX can override the part's BrickColors with your own colors.
Code:
local color1 = 1 --Local variables are obtained quicker than global variables. function color() script.Parent.Parent.Parent.Parent.Parent.Character["BodyColors"].HeadColor = BrickColor.new(color1) script.Parent.Parent.Parent.Parent.Parent.Character["BodyColors"].TorsoColor = BrickColor.new(color1) script.Parent.Parent.Parent.Parent.Parent.Character["BodyColors"].LeftArmColor = BrickColor.new(color1) script.Parent.Parent.Parent.Parent.Parent.Character["BodyColors"].RightArmColor = BrickColor.new(color1) script.Parent.Parent.Parent.Parent.Parent.Character["BodyColors"].LeftLegColor = BrickColor.new(color1) script.Parent.Parent.Parent.Parent.Parent.Character["BodyColors"].RightLegColor = BrickColor.new(color1) end script.Parent.MouseButton1Down:connect(color)
I would preferably use a LocalScript here and use game.Players.LocalPlayer to get to the character instead of constantly adding parents in as it makes your code look a lot cleaner.
I hope my answer helped you. If it did, be sure to accept it.
I don't know how to comment but the only thing wrong with Sponge is that Body Colors is a spaced instance so..
local color1 = 1 --Local variables are obtained quicker than global variables. function color() script.Parent.Parent.Parent.Parent.Parent.Character["Body Colors"].HeadColor = BrickColor.new(color1) script.Parent.Parent.Parent.Parent.Parent.Character["Body Colors"].TorsoColor = BrickColor.new(color1) script.Parent.Parent.Parent.Parent.Parent.Character["Body Colors"].LeftArmColor = BrickColor.new(color1) script.Parent.Parent.Parent.Parent.Parent.Character["Body Colors"].RightArmColor = BrickColor.new(color1) script.Parent.Parent.Parent.Parent.Parent.Character["Body Colors"].LeftLegColor = BrickColor.new(color1) script.Parent.Parent.Parent.Parent.Parent.Character["Body Colors"].RightLegColor = BrickColor.new(color1) end script.Parent.MouseButton1Down:connect(color)
You can also try using a Local Script which I prefer as it makes it cleaner and easier. You can't really connect to the Player without it.
local player = game.Players.LocalPlayer repeat wait() until player.Character local character = player.Character local color1 = 1 --Local variables are obtained quicker than global variables. function color() character["Body Colors"].HeadColor = BrickColor.new(color1) character["Body Colors"].TorsoColor = BrickColor.new(color1) character["Body Colors"].LeftArmColor = BrickColor.new(color1) character["Body Colors"].RightArmColor = BrickColor.new(color1) character["Body Colors"].LeftLegColor = BrickColor.new(color1) character["Body Colors"].RightLegColor = BrickColor.new(color1) end script.Parent.MouseButton1Down:connect(color)