RPC Compile error using FString

Reposted because I meant to put this in bug reports but only did the tag last time not the section

In my PlayerState I have the following:

.h

 UFUNCTION(Server, Reliable, WithValidation) void playerJoined(FString playerNameSent);

.cpp

 void AMyPlayerState::playerJoined_Implementation(FString playerNameSent) {
     //
 }
 
 bool AMyPlayerState::playerJoined_Validate(FString playerNameSent) {
     return true;
     //
 }

When I compile I get the following error:

 Severity    Code    Description    Project    File    Line    Suppression State
 Error    MSB3075    The command ""C:\Program Files\Epic Games\UE_4.18\Engine\Build\BatchFiles\Build.bat" AudioPartyEditor Win64 Development "C:\Users\Shawn\Documents\Unreal Projects\AudioParty\AudioParty.uproject" -waitmutex" exited with code 5. Please verify that you have sufficient rights to run this command.    AudioParty    C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.MakeFile.Targets    41    

After banging my head against the wall looking for typos I found if I change the type from FString to int32 or even FName then it compiles fine. FString seems to have issues.

Ok man the docs are fuzzy on this but I found the answer. You need const like so:

UFUNCTION(NetMulticast, Reliable, WithValidation) void playerJoined(const FString& playerNamesSent);

Hi Mctittles,

Your solution was correct for this error. The error that you showed from the Error List is a generic error. When you see an error like this in the Error List, you should look at what is shown in the Output window. This will usually show you what the actual error is. In this case, you would see this error:

D:/Unreal Projects/Current Issues/TestFString/Source/TestFString/MyPlayerState.h(19) : LogCompile: Error: Replicated FString parameters must be passed by const reference