change color render

i want to ask about change color render,

if i have some object with texture, my target cannot change the color using this command : " selectedTarget.renderer.material.color =; "

and it will shown some notification :
“MissingComponentException: There is no ‘Renderer’ attached to the “gomukha@play3” game object, but a script is trying to access it.
You probably need to add a Renderer to the game object “gomukha@play3”. Or your script needs to check if the component is attached before using it.”

how to fix it ?

thank you before :slight_smile:

Well just what the error says. Simply add a mesh renderer to the object. To do this, first select the object, go up to the “Component” drop-down menu, then hover over “Mesh”, and click on “Mesh Renderer”. That will add a renderer to your game object, and you should then be able to change the color.