_Implementation making bool undefined

hello every time i create a replicated function my bool isnt recognised inside the brackets but in all my other none replicated functions the bool is recognised.

character.h

 I have included #include "Net/UnrealNetwork.h" and #include "Engine.h"

UFUNCTION(Server, Reliable)
 void CrouchServ();

  bool mybool = false;

character.cpp

 void AMyCharacter::CrouchServ_Implementation()
  {
      mybool = true;
  }

Are you able to compile? If not, what does the compile output log say?

In my experience, usually this is just false alarm coming from Visual Studio (specifically affecting Intellisense), especially if the project hasn’t been compiled since the replicated UFUNCTION was written. This is because the Unreal Header Tool, during compilation, generates the declarations for those _Implementation functions, and before those are generated, Visual Studio doesn’t understand that the _Implementation function is a member of the same class as your other functions and variables, such as the bool from your example. Hence, red squiggly lines.

So, if you’re seeing those red squiggly lines in your IDE, sometimes all you need to do is compile. (Sometimes restarting Visual Studio afterward helps too.)