Change a Variable with another script not working (C#)

Hello, New to scripting and making a pong game with an upgrade shop. An upgrade I'm working on increases the player's speed but I have a problem communication from the Shop script to the player's paddle script.

[shop.cs]
    print("BUYING ITEM: "+itemName+" Item ID: "+itemID+" for $"+itemGold);
                plyMoney = plyMoney - itemGold;
                upgradeSpeed = upgradeSpeed +1;
                print(upgradeSpeed);
                var playerScript = GetComponent<PlayerPaddle>();
                playerScript.playerSpeed = playerScript.playerSpeed + 5;
            } else {
                print("Not enough money for item: "+itemName);
            }

The script is meant to get the playerSpeed variable from the PlayerPaddle script and then increase it by 5. But it gives me the error:

NullReferenceException: Object reference not set to an instance of an object Shop.DoMyWindow (Int32 windowID) (at Assets/ Scripts/Shop.cs:53) UnityEngine.GUI+_Window.Do () (at E:/BuildAgent/work/71ca6fec1b41cc30/Runtime/Export/Generated/GUI.cs:1152) UnityEngine.GUI.BeginWindows (UnityEngine.Event e, Int32 skinMode, UnityEngine.IDList idlist, Int32 editorWindowInstanceID) (at E:/BuildAgent/work/71ca6fec1b41cc30/Runtime/Export/Generated/GUI.cs:1372)

Is this script attached to the player? If not, then GetComponent will not return anything, since whatever you have this on has no "PlayerPaddle" script. Try caching the player GameObject in this script and getting the paddle component and player speed through that.

P.S. You might want to consider using a function in the player paddle script to increment the player speed rather than incrementing it directly. It's cleaner and segregates your code.