I am trying to make my avatar's body parts change into random colors, but then it keeps saying, "x is not a valid member of BodyColors," but c has information in it. I used this script:
local c = {"HeadColor", "LeftArmColor", "LeftLegColor", "RightArmColor", "RightLegColor", "TorsoColor"} local x = c[math.random(1,6)]
function a() local snak = game.Workspace:WaitForChild("snaks308070") snak:WaitForChild("Body Colors", 3).x = BrickColor.Random() end
while true do wait() a() end
Any help?
Similar to
Parent['Child_Name_String']
These can also be used to locate properties.
local partn = Instance.new('Part',workspace) partn.Name = 'Part_ex' local ex_name = partn['Name'] print(ex_name ) -- prints Part_ex.
Mainly because properties are like children, as such, they have similar features like this.