can't change variable through other script

I am making a game about planes and I having some problem with inheritance
First I have created varible called “YükseltmeHakkı” (UPGRADING RIGHT):

using UnityEngine.UI;
public class UpgradeRemainder : MonoBehaviour {

    public int YükseltmeHakkı;

	public void Update () {
		 YükseltmeHakkıText.text = "Kalan yükseltme hakları: " + YükseltmeHakkı;
	}

Then I called this variable from anaother script in this function:

public void UpgradeDamage()
    {
        if(upgradeRemainder.YükseltmeHakkı > 0)
        {
        Damage += 5;
            upgradeRemainder.YükseltmeHakkı--;
        }

Normally,this code supposed to work when I presssed the button (decrease YükseltmeHakkı). But when I pressed the button that script is assigned to it does nothing (even when YükseltmeHakkı is bigger than 0).

Why could this be happening and how could I overcome this problem please help.

do not cut pieces of code out of their context because then you’re cutting out possibilities as to what the problem might be caused by and people won’t bother answering.

Please show us how you initialized UpgradeRemainder in your second script, you need to have

public UpgradeRemainder upgradeReminder;
in second script, and assign your original UpgradeReminder to game object with second script through inspector.

Or you can do this in second script.

upgradeRemainder = GameObject.Find(“TheNameOfGameObjectFirstScriptIsIttachedTo”).getComponent();

Also make sure your YükseltmeHakkı has default value which is higher than 0, otherwise its not gonna pass if() statement