Why when I try to change the brickcolor it doesnt work

ok so this is my script and for some reason when I try to change the hand color (from the custom outfit) it wont change it

game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local newPlayerOutfit = game.ReplicatedStorage:WaitForChild(“PlayerOutift”):Clone()
newPlayerOutfit.Parent = character

	for i, v in pairs(newPlayerOutfit:GetChildren()) do
		for i, x in pairs(character:GetChildren()) do
			if v.Name == x.Name.."1" then
				local weld = Instance.new("WeldConstraint")
				weld.Parent = character
				newPlayerOutfit.Lhand.BrickColor = character["Right Arm"].BrickColor
				newPlayerOutfit.Rhand.BrickColor = character["Left Arm"].BrickColor
				v.CFrame = x.CFrame
				v.CFrame *= CFrame.Angles(
					math.rad(0),
					math.rad(180),
					math.rad(0)
				)
				weld.Part0 = x
				weld.Part1 = v
				x.Transparency = 1
			end
		end
	end
22 Likes

Maybe print newPlayerOutfit.Lhand.BrickColor and character["Right Arm"].BrickColor and see what they say, maybe that can help

10 Likes

I printed both of them and they bring
image

13 Likes

not sure why if that is not the color of them

11 Likes

So if you look in the explorer then the BrickColor of the character’s arm is something other than Medium stone grey?

16 Likes

Not sure if this will help you or not as I don’t work with r6 bodies.
This is a snippet from a few of my scripts for a r15 body.

local rgb=(Color3.fromRGB(51, 52, 59))
local co=character:FindFirstChild("Body Colors")
if co.TorsoColor3==co.LeftLegColor3 then 
	co.TorsoColor3=rgb
	co.LeftArmColor3=rgb
	co.RightArmColor3=rgb
end task.wait(1.5)

Notice I’m working directly with the Body Colors and not the part itself.
This is part of two touched script that toggles “black-ish gloves” with their normal hand color.
(I’m just changing the hand color and I want the neck color to match that)

Snippet from the other touched script.

local rgb=(Color3.fromRGB(51, 52, 59))
local co=character:FindFirstChild("Body Colors")
if co.TorsoColor3==rgb then 
	co.TorsoColor3=co.LeftLegColor3
	co.LeftArmColor3=co.LeftLegColor3
	co.RightArmColor3=co.LeftLegColor3
end	task.wait(1.5)

In these you can’t see the Left Leg (it’s covered by the outfit) so, I’m using it as color reference of their original body color.

13 Likes

I tried to do this
newPlayerOutfit.Lhand.Color = co.LeftArmColor3
but for some reason I dont know why it brings me this error
ServerScriptService.PlaceUniform:12: attempt to index nil with ‘LeftArmColor3’
even tho there is LeftArmColor3

13 Likes

yeah my left arm is not gray
image

11 Likes

This is the part itself …not the Body Colors… I’m only changing Body Colors.
When your change is refreshed it will use Body Colors as the color.

11 Likes

but the thing is that newPlayerOutfit is not a rig its a model which is why I cant use body colors on it

9 Likes

newPlayerOutfit.Lhand.BrickColor
Hmm, so this is not the hand?

Also, you may want to refer to that as;
newPlayerOutfit:FindFirstChild(“Lhand”).BrickColor

Like I said I never work with r6 bodies or BrickColor so, maybe someone with more knowledge about this than me can help you better.

7 Likes

image
I found the solution at the end I just had to add a wait 2 seconds because for some reason the colours take a bit to load

10 Likes

This was the 1st thing I was thinking … shoulda went with it.
That’s also why you see the task.wait(1.5) in my scripts. Glad you figured it out.

7 Likes