I'm trying to change all of the player's body colors to the same color of the player's head. I currently have a table containing the different colors of the class "BodyColors", and I'm attemtping to go through the table and set that specific color to that of the head, in the "BodyColors" class. However when I run the program, I get this error:
Workspace.ExcelUp.ChangeBodyColors:5: attempt to index a nil value
The script is located in the "StarterCharacterScripts" of the "StarterPlayer". Please can somebody help me?
Character = script.Parent
BodyColors = {"HeadColor", "LeftArmColor", "LeftLegColor", "RightArmColor", "RightLegColor", "TorsoColor"}
for _,Color in pairs(BodyColors) do
Character:FindFirstChild("Body Colors")[Color] = Character:FindFirstChild("Body Colors")["HeadColor"]
end

1 comment
Thank you. Much appreciated. I guess I'll work some more on using FindFirstChild and WaitForChild in the correct instances, to prevent this problem occuring again in the future. Again, thank you.