I'm trying to change the hair color of the character in an easy way using "WaitForChild" I've tried "FindFirstChild" too, but it only works if I put the specific name of that, butit can be any one depending on the choice of the player
(When the player appears, a folder is created on the "head" of the character, depending on the player's choice one of the hairs will go there, I named Hair1, Hair2 and so on, and I try to change the color of that inside the folder)
what's wrong and how do i fix it?
I am a total beginner in scripting
game.ReplicatedStorage.Events.HairColorEvent1.OnServerEvent:Connect(function(plr)
local color = BrickColor.new("Baby blue")
local char = plr.Character
char.Head.Hair:WaitForChild().BrickColor = color ?------error "argument 1 missing or nil"
end)

3 comments
The part your waiting for needs to be inside the parenthesis of WaitForChild()
yes the "WaitForChild()" needs an object to wait for in the "()" for example -
local RS = game:GetService("ReplicatedStorage") local Function = RS:WaitForChild("Touched")