Photon Network - Porting a code?

Okay so I was following the a tutorial from SpeedTutor on Youtube : [Unity 4] Crysis style invisibility / Cloaking (JavaScript) - YouTube
So I wanted to port it to my network character but, I placed it on the gun and the player model and when I pressed the key to turn invisible it turns the other player invisible as well and the other player does not see it happen. Can someone please help me? Cloak and Network Character script below if needed :slight_smile:

Cloak Script:

#pragma strict

var materials : Material[];
var materials_counter : int = 0;

var sounds : AudioClip[];
var sounds_counter : int = 0;

function Update()
{
	if(Input.GetKeyDown("f"))
	{
		renderer.material = materials[GetNextMaterialIndex()];
		audio.clip = sounds[GetNextSoundIndex()];
		audio.Play();
	}
}

function GetNextMaterialIndex() : int
{
	materials_counter++;
	if(materials_counter == materials.Length)
	{
		materials_counter = 0;
	}
	return materials_counter;
}

function GetNextSoundIndex() : int
{
	sounds_counter++;
	if(sounds_counter == sounds.Length)
	{
		sounds_counter = 0;
	}
	return sounds_counter;
}

Network Character Script:

using UnityEngine;
using System.Collections;

public class NetworkCharacter : Photon.MonoBehaviour {

	Vector3 realPosition = Vector3.zero;
	Quaternion realRotation = Quaternion.identity;

	Animator anim;

	bool gotFirstUpdate = false;
	// Use this for initialization

	
	// Update is called once per frame
	void Update () {
		if( photonView.isMine ) {
			// Do nothing -- the character motor/input/etc... is moving us
		}
		else {
			transform.position = Vector3.Lerp(transform.position, realPosition, 0.1f);
			transform.rotation = Quaternion.Lerp(transform.rotation, realRotation, 0.1f);
		}
	}

	public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) {
		if(stream.isWriting) {
			// This is OUR player. We need to send our actual position to the network.

			stream.SendNext(transform.position);
			stream.SendNext(transform.rotation);
		}
		else {
			// This is someone else's player. We need to receive their position (as of a few
			// millisecond ago, and update our version of that player.

			// Right now, "realPosition" holds the other person's position at the LAST frame.
			// Instead of simply updating "realPosition" and continuing to lerp,
			// we MAY want to set our transform.position to immediately to this old "realPosition"
			// and then update realPosition


			realPosition = (Vector3)stream.ReceiveNext();
			realRotation = (Quaternion)stream.ReceiveNext();

			if(gotFirstUpdate == false) {
				transform.position = realPosition;
				transform.rotation = realRotation;
				gotFirstUpdate = true;
			}

		}

	}
}

From what I can see you’re not sending the invisible state over the network and applying it to the player?

So essentially in your player script you do

Update() {

  If(myPhotonView.Ismine){
    Check for keypresses or whatever and store data to be sent over network in variables

  }else {
    apply the variables you've received from the network things like invisible, movement etc



  }


}