changing a variable in an other gameobject gives a stub error

i need to change a variable in a script on another game object

var CurAmmo:int;
var theclip:Transform;
var clipscrip :Component;

function OnCollisionEnter(other:Collision){
theclip=other.transform;
clipscrip=theclip.GetComponent(clip);
CurAmmo=clipscrip.ammo;}

so far all is fine but when i do

function beAgun(){
clipscrip.ammo–;}

i get an error saying
Expression ‘self.clipscrip.ammo’ cannot be assigned to.

what a i doing wrong , thanks for the help

I don’t know how you can access “ammo” from a component without an error from Unity, but make sure ammo isn’t read only.

ammo is a float in the script that is referenced , i can read it just fine but i cannot set it

solved !! you cannot do certain operation on external scripts
i was calling
clipscrip.ammo–;

the alternative is
clipscrip.ammo=clipscrip.ammo-1;