GetChildren returns an array of children, it does not return a dictionary.
What’s the use of GetChildren here?
You can just do workspace.Arm1.Part etc.
no like what @return_end1 said, you are using GetChildren that gets an array of stuff inside of workspace, why do you need to do that if you are trying to find certain parts?
Hello! As @return_end1 explained, the script errors because CC is a table, not an object. Since you also have doubts on when to use local or regular scripts, you could do that this way:
Local script
script.Parent.MouseButton1Click:Connect(function()
event:FireServer() -- you can also add arguments in there, such as the color!
end)
You have to define event, which should be a RemoteEvent object located, for instance, inside game.ReplicatedStorage. When used correctly, these can make your game safer against exploits. See more info here.
Normal script
event.OnServerEvent:Connect(function()
local CC = workspace -- Your actual bug!!!
local color = BrickColor.new(“Navy blue”) -- Tip: memorizing a variable is usually less expensive than creating tons of new BrickColor values
CC.Arm1.Part.BrickColor = color
CC.Arm2.Part.BrickColor = color
CC.Chest.Part.BrickColor = color
CC.Leg1.Part.BrickColor = color
CC.Leg2.Part.BrickColor = color
end)
Likewise, you will have to reference the event here too.