BrickColor won't change on function

I’ve got this script to change the hair of the Avatar stand, it’s for character customization.
I figured that this script would work but it’s not. Anyone know why?

For reference Handle is the hair itself, the script’s parent is a GUI which you click on to give yourself the hair colour.
The script I made for giving yourself the hair works, but it doesn’t display the hair on the Stand.

local StandHair = workspace.Stand.Default.Handle.BrickColor
local HairFrame = script.Parent
local B = "Light yellow"
script.Parent.Blonde.MouseButton1Click:Connect(function()
	StandHair = BrickColor.new(B)
end)

I think B is not the correct colour, try “Bright yellow”. You can check the colour pallet. Hove your mouse over the chosen colour, it should show a name for it.

LocalScript is for the player to click on button. ServerScript is for server to change the color. I add a RemoteEvent as you see in the setup image below and named it changecolor. If the Hair is a mesh or have a specialmesh and it have a Texture already then simply changing the Handle color won’t work. You have to delete the TextureId in the properties of the mesh so that color changing of the Handle will be visible.
image

LocalScript:

local HairFrame = script.Parent
local Blonde = HairFrame:WaitForChild("Blonde")
local remote = script.Parent:WaitForChild("changecolor")

Blonde.MouseButton1Click:Connect(function()
	remote:FireServer()
end)

Server Script:

local StandHair = workspace:WaitForChild("Stand"):WaitForChild("Default"):WaitForChild("Handle")
local B = "Light yellow"
local remote = script.Parent:WaitForChild("changecolor")

remote.OnServerEvent:Connect(function()
	StandHair.BrickColor = BrickColor.new(B)
end)

Thank you so much, actually. Thanks for taking the time to demonstrate it all!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.