I have a script within a gui that allows the player to change the color of their hair/clothes/etc to whatever they choose. The problem is it can get pretty messy. I have a bunch of similar scripts for each color and it's really building up. Is there an easier way to call certain parts from a morph's head and chest parts?
playerman = script.Parent.Parent.Parent.Parent.Parent.Character
function changecolor()
-- headparts
playerman.HeadPart.HairTop.BrickColor = BrickColor.new("Persimmon")
playerman.HeadPart.Hair.BrickColor = BrickColor.new("Persimmon")
playerman.HeadPart.EyebrowsMad.BrickColor = BrickColor.new("Really red")
playerman.HeadPart.EyebrowsNeutral.BrickColor = BrickColor.new("Really red")
playerman.HeadPart.HairBack.BrickColor = BrickColor.new("Persimmon")
-- chest
playerman.Chest.Cap.BrickColor = BrickColor.new("Salmon")
playerman.Chest.Shirt.BrickColor = BrickColor.new("Crimson")
playerman.Chest.Hat.BrickColor = BrickColor.new("Really red")
wait()
end
script.Parent.MouseButton1Click:connect(changecolor)

3 comments
Well, I would recommend to have variables for the "playerman.HeadPart" sections to prevent repetitive retypings, and perhaps (maybe(?) create variables for the separate colours, or a table, but I don't recommend that option, as that'll take a lot more work, same with the making variables for the colours, as I can't 100% confirm that that can solve your problem/ question. ;c
I have an idea of what method to use but I don't know the proper termonolgy of what it's called. Either tables or instances or..? Something like that. I tried researching them but I don't know how to apply them to my scripts :(
If I had to guess, are you referring to Arrays? But more specifically, Dictionaries? http://wiki.roblox.com/index.php?title=Table#Dictionaries