Change color only on my Player

Hello

I have a simple script that changes the player’s Team Color with the button J. But the problem is is when another player joins the Host and tries to change his team color, it changes everyone’s Team color

Heres my script, it works fine:

    var myMaterials : Material[];
var NextMaterial : int = 0;

private function NextMaterialUsed()
{
renderer.sharedMaterial = myMaterials[NextMaterial];
if(NextMaterial < myMaterials.length-1)
NextMaterial += 1;
else
NextMaterial = 0;
}

function Update () 
{
if(Input.GetKeyDown("h"))
{
NextMaterialUsed();
}


}

Thanks in advance

  • Felipe

Use renderer.material, not renderer.sharedMateral.