Server not setting brickcolor for clients?

  1. What do you want to achieve?
    I want to change the color of a body part to a color3 value i have but something is wrong

  2. What is the issue?
    Im setting the color correctly(according to every guide) but it isnt applying
    image
    (Shirt stays blue(regular color))

  3. What solutions have you tried so far?
    devforum, google, videos(couldnt find any), experimenting

game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
		
		local saves = plr.hidden
		if saves.isMale.Value then
		elseif saves.isMale.Value == false then
		
			
			local humanoid = char:WaitForChild("Humanoid")
			local Hair = game:GetService("ReplicatedStorage")["Brown Hair"]
			
				local acc = Hair:Clone()
				-- Attach the Accessory to the humanoid.
				humanoid:AddAccessory(acc)
		end
		
		char.Torso.Color = saves.shirtColor.Value -- this is what is suppose to change it
		print("Shirt Set") -- print works
		
	end)
end)

Check if the character has a BodyColors instance, if it has one, instead of changing the color of the torso directly by it, change it by the BodyColors.

	char["Body Colors"].TorsoColor3 = saves.shirtColor.Value
		print("Shirt Set")

Doesnt seem to be working unless i did something wrong, no errors

Update


I moved the lines that change the color to the top but they only change the color for the server not the client

Nvm only happened once

Maybe adding a wait() would work?

If it happens only when joining the game, and not while editing the avatar, it’s surely because of stuff loading in and replicating to the client, so waiting 1-3 seconds after the character spawn for first time would fix it.

Thanks, that was the problem and after messing around with the solution I did this

while true do
				if char["Body Colors"].TorsoColor3 ~= saves.shirtColor.Value then
				task.wait(.1)
				char["Body Colors"].TorsoColor3 = saves.shirtColor.Value
					print("Shirt Again")
					else break 
					end
			end

So I have to wait less, not sure how the server likes this but I can easily revert it

Won’t recommend using while loops like that on the server, remember that it’s for every single player character in the game, I would just recheck like 2 times after a char spawned first time if the torso color is correct, not every .1 seconds.
Also, the while loop doesn’t break after a character died, so if one of your game servers have been going on for a long time, and 2000 characters have spawned, it means there’s 2000 while loops going on on the server, which is just not good and can increase server lag.
If you wanna keepusing while loops, I would suggest using break if the character comes to be nil.

Didnt think about that, thanks