C++ Variables Not Replicating

I’ve been trying to figure this out for the past couple weeks, I’m trying to get an int to change on the server and have the change appear on the client too, just trying to learn the engine for the first time, don’t have an exact need for it yet.

Here’s my TestActor.h


#pragma once

#include "Core.h"
#include "GameFramework/Actor.h"
#include "TestActor.generated.h"

UCLASS()
class FISSURER_API ATestActor : public AActor
{
    GENERATED_BODY()

public:    
    // Sets default values for this actor's properties
    ATestActor();

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

    UPROPERTY(Replicated)
        uint32 testInt;

public:    
    // Called every frame
    virtual void Tick(float DeltaTime) override;

};

And my TestActor.cpp


#include "TestActor.h"
#include "Net/UnrealNetwork.h"

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

    DOREPLIFETIME(ATestActor, testInt);
}

// Sets default values
ATestActor::ATestActor()
{
     // Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
    PrimaryActorTick.bCanEverTick = true;

}

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

}

// Called every frame
void ATestActor::Tick(float DeltaTime)
{
    Super::Tick(DeltaTime);
    if (HasAuthority())
    {
        ++testInt;
        UE_LOG(LogTemp, Log, TEXT("Server %d"), testInt);
    }
    else {
        UE_LOG(LogTemp, Log, TEXT("Client %d"), testInt);
    }
}

Here’s the log that gets printed in the game


LogTemp: Client 0
LogTemp: Server 43
LogTemp: Client 0
LogTemp: Server 44
LogTemp: Client 0
LogTemp: Server 45
LogTemp: Client 0
LogTemp: Server 46
LogTemp: Client 0
LogTemp: Server 47
LogTemp: Client 0
LogTemp: Server 48
LogTemp: Client 0
LogTemp: Server 49
LogTemp: Client 0
LogTemp: Server 50
LogTemp: Client 0
LogTemp: Server 51
LogTemp: Client 0
LogTemp: Server 52
LogTemp: Client 0
LogTemp: Server 53
LogTemp: Client 0
LogTemp: Server 54
LogTemp: Client 0
LogTemp: Server 55
LogTemp: Client 0
LogTemp: Server 56
LogTemp: Client 0

I tried running with a dedicated server with 1 player, and no dedicated server 2 players, and dedicated server 2 players, all with the same result.
It’s definitely running on both the client and server, but it’s not replicating on the client, I tried this on my laptop too with the same result. I remember this was JUST working a couple weeks ago for me too. I’d love any help, thx!

You need to tell the actor to replicate, since they don’t by default:



ATestActor::ATestActor()
{
bReplicates = true;
}


That fixed it! Thank you!