Server Spawns actors on client with wrong parameters

Hi there.

I spawned an actor in Server and the actor itself is replicated. This actor has some editable and expose on spawn variables which I set them on spawn or even after spawn but the problem is in client all the actors have the default parameters and those changes didn’t affect it. in this example the width or random color of those green cubes.

I find out I can use a function in C++ which spawn an actor and let you change your desired parameters and run ConstructionScript after all. So I created two C++ class one named TerrainBuilder and one as my module parent, named ModuleParameters. I created ModuleWidth variable in C++ parent and I created a blueprintcallable function in TerrainBuilder to SpawnDeferred. After spawning I changed ModuleWidth and finished spawn. But Still the same result.
This making me crazy, can anyone help please?

AModuleParameters* ATerrainBuilder::SpawnDeferred(TSubclassOf<AModuleParameters> ToSpawn, FTransform SpawnTransform)
{
	auto MyDeferredActor = Cast<AModuleParameters>(UGameplayStatics::BeginDeferredActorSpawnFromClass(this, ToSpawn, SpawnTransform));
	if (MyDeferredActor != nullptr)
	{
		MyDeferredActor->SetModuleWidth(2);
		UGameplayStatics::FinishSpawningActor(MyDeferredActor, SpawnTransform);
	}
	return MyDeferredActor;
}

Hi Friend
You’ll Find the answer of your question here: