How to pass a int from a object to another

Hi, I have a problem, I have an object part of another bigger and I want this small object pass one of his ints to the bigger one, I have done this on the big object:

number= playerTriggered.gameObject.SendMessage("SayNumberOfPlayer");

And this one on the smaller:

function SayNumberOfPlayer() : int {
    return numberofplayer;

But I experience this error:

Assets/nuevo/Scripts/Tank.js(16,78): BCE0022: Cannot convert 'void' to 'int'.

What I'm doing wrong?

The problem you are having is SendMessage doesn't return a value, so you are assigning your int to 'no' value.

Rather use GameObject.GetComponent

It allows you to get a get a reference to your object. Once you have a reference to the object, you can then create a variable and assign it to the value of your SayNumberOfPlayer() method returned via GetComponent.