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? Line 24 is the issue although there is no output error, I am almost positive it is, 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(b ucnhOfColor[#bucnhOfColor]) else d.Handle.BrickColor = bucnhOfColor[val] end end end) end)
You seem to like using the method I showed you, haha
That's at least what I thought of like when I ad-lib.
Have you read the output? When you assign a value to a BrickColor property, the new value should be a BrickColor datatype, did you notice? It appears that you're trying to apply a String (text) value to the Handle's BrickColor at line 26.
That being said, the new value should be BrickColor.new(bucnhOfColor[val])
instead.
Now, to prevent further... unwanted events from occurring, you should not include those asset IDs for shirts in that script anymore. Also, I now doubt that you're trying your best to fix the issue on your own, so if you aren't, you should try harder before asking us! :)
Also, if the Handle of the accessory has a Mesh and a texture, the texture (with little to no transparency) may override the Handle's color. You should remove its texture if it has one, or just keep it if you think the texture synchronizes with the color of the Part.
As regards what I first mentioned above, here is an abbreviated illustration on how to fix it.
--yea it's simple --Your script from line 23 if val >= #bucnhOfColor then d.Handle.BrickColor = BrickColor.new(bucnhOfColor[#bucnhOfColor]) --this is correct else d.Handle.BrickColor = BrickColor.new(bucnhOfColor[val]) --this line was wrong, now it should be fixed. end
Simple as that!
Tell me if you have more issues arriving after. Cheers!