My Button Run My Method But Ignore If statement

Hello all, i have a problem. iam making a game that have button for buy item , and the button have no issue, it run normally, but the problem is the button immediately executes the method without seeing that the method contains an if statement, so what is wrong here
Here’s the code :

    public void TakeMoney()
        int minusCoin = PlayerInfo.coin -= 5;
        PlayerPrefs.SetInt("MyCoinAmount", minusCoin);

    public void DisableBuyButton()
        disableBuyButtonRocket3 = 1;
        PlayerPrefs.SetInt("DisableBuyButtonRocket3",  disableBuyButtonRocket3);

    public void Buy()
        int getPlayerCoin = PlayerInfo.coin;
        if (getPlayerCoin > 4)
            if (MyRocket._rocket3 == 1)

                MyRocket._rocket3 = 1;
                PlayerPrefs.SetInt("Rocket3Bought", MyRocket._rocket3);

so the button will perform all of the 3 functions above, but as can be seen that I make an if statement so the item can only be purchased if we already have enough money, but when I try I try to reset all values, so my money by default it is 0, but I can buy the item and my money becomes a minus.

Btw, PlayerInfo above is a script from another scene.

Sorry for my bad english.

I don’t know where you set value of PleyrInfo.coin. There is no way that the if statement is ignored, te result in if must be true. Try to call

Every time when you want to set value.

Edit: On Windows standalone players, PlayerPrefs are stored in the registry under HKCU\Software[company name][product name] key, where company and product names are the names set up in Project Settings.

So this is not best idea to use it like this.