UGameplayStatics::GetGameInstance() takes a parameter, UObject* WorldContextObject, because of reasons related to multiplayer that aren’t particularly important. All that really matters is that you need to provide some object that knows what World/level it’s in, to get to the right GameInstance (because there could be many). You’ll see this parameter in a lot of static functions.
In your case, with an actor member function, you can go with the trivial option of passing this as the World Context. So:
UFYP_GameInstance* GM = Cast<UFYP_GameInstance>(UGameplayStatics::GetGameInstance(this));
Compiler errors are not a log. You’ll need to get comfortable reading & understanding compiler and linker errors if you’re going to write C++. Otherwise you’re progress will be deathly slow if you have to go to the internet for every one. Not a judgement, it sounds like you’re new to C++ and that’s great. Welcome to the dark side! Just something to keep in mind as you move forward.