I actually find it helpful to share answers, not just tell people they are wrong and to go read more docs. Thus :
Create a C++ blueprint library with a get and set method. In the CPP file add the static variable you wish to edit or retrieve.
Header :
#pragma once
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "BPFL_WorldUtilities.generated.h"
UCLASS()
class EOS_FPS_API UBPFL_WorldUtilities : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
UFUNCTION(BlueprintCallable, Category = "Networking")
static void SetCurrentLobbyID(FString ID);
UFUNCTION(BlueprintCallable, Category = "Networking")
static FString GetCurrentLobbyID();
};
Script :
#include "BPFL_WorldUtilities.h"
static FString LobbyID;
void UBPFL_WorldUtilities::SetCurrentLobbyID(FString ID)
{
LobbyID = ID;
}
FString UBPFL_WorldUtilities::GetCurrentLobbyID()
{
return LobbyID;
}
I see a similar answer was given in the comments by @ok_gida