How to make a player change into other objects

Hello,

I’ve been doing unity for a long while now, but only the scripting part is still tricky.
I am making a kind of a PropHunt game, and i need help with my JavaScript.
I already have that when you click, you change into a object, but then you cant walk or move.
i have seen alot of other unity forums and documents, but nothing helps.
any help will be appreciated. thanks.
My script:

var player : GameObject;

var Changer : GameObject;

var AnimObject : GameObject;

var Spawn_Position;

function OnMouseUp(){
	Destroy(gameObject);
	Instantiate(Changer,AnimObject.transform.position,AnimObject.transform.rotation);
	}

	function Update ()
	{
	if(OnMouseUp == true){
		Instantiate(Changer,AnimObject.transform.position,AnimObject.transform.rotation);
		
	}
	}

You’re destroying the object with the script on it on mouse up. Any other scripts on that object will not work after that.

The code in Update() should not be there.

Variable names should be lowercase.

Here is the help with Javascript you need.

You could change the mesh or have an empty parent object that has all the objects you wish to change in to as children. Depending on how you are planning on using the different objects you change in to (different skills for example), you could have a simple script that changes the player’s form on the parent and then just make the other objects active or inactive.

No need to instantiate in my opinion, many people do something similar to the above. Easier just to turn some things on and off.