accessing float value from another script c#

I’ve built a function in script A that returns a float value, and now want to set it in script B.

i tried something like this but get a conversion error:

in script B:
private void checkProgress()
{
playerLevel = player.GetComponent(“Stats”).BroadcastMessage(“CheckLevel”, SendMessageOptions.DontRequireReceiver);
}

in script A:
public float CheckLevel()
{
return level; // returns level which is instanced as a public float value;
}

What i’m trying to do with these two functions is check and see if the player has leveled while fighting enemies to eventually scale the enemies to the player to keep the game challenging.

Why don’t you just use:

in script B:
private void checkProgress()
{
playerLevel = player.GetComponent().CheckLevel();
}

in script A:
public float CheckLevel()
{
return level; // returns level which is instanced as a public float value;
}

MMOInteractive is correct. BroadcastMessage returns void so you can’t use it to do assignments.