Why is replication not working for float/bool?

Hello!

I am very new to UE4 and am trying to set up my first basic Networking game. I am doing something very simple, i am trying to replicate a bool or a float from my AActor. I have the following code:

MazeCreator.h

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
...
#include "MazeCreator.generated.h"

// if this fails change to development editor
UCLASS()
class MAZE3PS_API AMazeCreator : public AActor
{
	GENERATED_BODY()
	
public:

	// Sets default values for this actor's properties
  AMazeCreator(const FObjectInitializer& ObjectInitializer);
  ~AMazeCreator();

  virtual void GetLifetimeReplicatedProps(TArray< FLifetimeProperty > & OutLifetimeProps) const override;

  bool IsSupportedForNetworking() const override;

protected:
	// Called when the game starts or when spawned
	virtual void BeginPlay() override;

private:
  
  UPROPERTY(ReplicatedUsing=OnRep_hasMaze)
    float hasMaze = 0;

  void ServerSetHasMaze();
  
  UFUNCTION()
  void OnRep_hasMaze();
};

MazeCreator.cpp

#include "MazeCreator.h"
...
#include "EngineUtils.h"
#include "UnrealNetwork.h"

// Sets default values
AMazeCreator::AMazeCreator(const FObjectInitializer& ObjectInitializer)
  : Super(ObjectInitializer)
{
  bReplicates = true;
  bAlwaysRelevant = true;
}

// Called when the game starts or when spawned
void AMazeCreator::BeginPlay() {
  Super::BeginPlay();

  if (HasAuthority()) {
    this->ServerSetHasMaze();
  }
}

void AMazeCreator::ServerSetHasMaze() {
  if (HasAuthority()) {
    this->hasMaze = 1;
    OnRep_hasMaze();
  }
}

// gets called when hasMaze gets replicated
void AMazeCreator::OnRep_hasMaze() {
  if (HasAuthority()) {
    UE_LOG(LogTemp, Error, TEXT("hasMaze turned on server"));
  } else {
    UE_LOG(LogTemp, Error, TEXT("hasMaze turned on client"));
  }
}

void AMazeCreator::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const {
  Super::GetLifetimeReplicatedProps(OutLifetimeProps);

  DOREPLIFETIME(AMazeCreator, hasMaze)

}

bool AMazeCreator::IsSupportedForNetworking() const {
  return true;
}

The problem is that I am actually using the bool/float to render a maze on the screen. The server renders the maze but the client doesn’t. If i look at the Editor Output logs, when running in Single Process mode, I can see that the server logs “hasMaze turned on server” but the client never prints it. I also know that the client logs are being printed there as my client player falls past the rendered maze on the server and because of that starts printing warnings about ignoring the server correction to the player movement.

So my question is, what am i doing wrong here and why is hasMaze not getting replicated in my MazeCreator class?

Let me know if you need anything else from me,

Thanks for the Help!

Tyler

This was fixed by adding:

if (HasAuthority()) {
    this->SetReplicates(true);
}

instead of 

this->bReplicates = true;

in the constructor and making the variable a Public bool/float instead of private