Clicking a sprite to enable script

In unity 2D i have the scripts for moving, and everything else but i want it to not enable controls for that object unless i click it and having AI that wanders but you can click them to control them

Update: first i tried it it just said "expecting (, ‘OnMouseDown’ and if its C# it would say parsing error

also what im trying to say is if there is a character he would be moving around but if i click on him it will disable moving then turn on playercontrols. also i only have player controls not AI or anything (this is my first time using Unity)

Agreed with bobin115, you should probably try OnMouseDown() function, which is called everytime a GameObject is clicked

this i a code i quickly wrote (untested). basically when you click the object with the script on it will enable your selected script.

var script : thescript;

function Start() { script = GetComponent(thescript); script.enabled = false;

function OnMouseDown() {
    script.enabled = true;
}

hope this helps