I have this script that if you have a value, you should get a new hair color on a reset or join, but it doesn't work? Any help, heres the script.

local bucnhOfColor = {
    [1] = "Black", --Default Shirt
    [2] = "Pine Cone", -- Army green
	[3] = "rbxassetid://2397305859", --Guess reckless
	[4] = "rbxassetid://885261392", --Hawaiian shirt
	[5] = "rbxassetid://3144003341", --JackMercando shirt
	[6] = "rbxassetid://3152639503", -- Osito Pink Shirt
	[7] = "rbxassetid://668772580", -- Red Jacket
	[8] = "rbxassetid://554084413", -- Supreme Worldflags
	[9] = "rbxassetid://2970602368", -- Tank top
	[10] = "rbxassetid://2072675468", -- Tommy hilfiger
	[11] = "rbxassetid://2641146107", -- Tour Jacket
	[12] = "rbxassetid://604130756", -- Yellow puffer
	[13] = "rbxassetid://393696145", -- Yellow puffer
}

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:Connect(function(character)       
		local d = character:WaitForChild("Hat")
		local val = player:WaitForChild("leaderstats").HairColor.Value
        if val >= 1 then
            wait(1)
			if val >= #bucnhOfColor then
				d.Handle.BrickColor = BrickColor.new[bucnhOfColor[#bucnhOfColor]]
			else
				d.Handle.BrickColor =  bucnhOfColor[val]
			end
        end
    end)
end)

1 comment

0

im not sure if this is the case, but do you have to use a mesh?