Attached Actors to components not moving with the Character

Hi everyone…

I am creating weapon on the server through a character and attaching that weapon the client. The problem Is the weapon is not moving on the clients.

I use

ItemMesh->AttachTo(OwningPawn->GetMesh(), FName(TEXT("WeaponSocket_Rifle")));

TO do the attachment. However if I attach the the actor to another actor directly, it works something like this

AttachRootComponentToActor(OwningPawn);

Here are the printscreen of both the effects

http://s11.postimg.org/vaqbhrcgz/Untitled.jpg

http://s11.postimg.org/dlykq50pv/Untitled2.jpg

Here are my codes.

Character Class

.h

/* [Server] */
	void SpawnDefaultWeapon();

.cpp

void APSETPCCharacter::BeginPlay()
{
	if (Role == ROLE_Authority)
	{
		SpawnDefaultWeapon();
	}
}


void APSETPCCharacter::SpawnDefaultWeapon()
{
	if (Role < ROLE_Authority)
	{
		return;
	}

	if (DefaultWeapon)
	{
		UWorld* World = GetWorld();
		if (World)
		{ 
			ABaseWeapon* TempWeapon = GetWorld()->SpawnActor<ABaseWeapon>(DefaultWeapon);
			TempWeapon->SetOwner(this);
			TempWeapon->OnEquip();
			CurrentWeapon = TempWeapon;
		}
	}
}

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

	DOREPLIFETIME(APSETPCCharacter, CurrentWeapon);
}

Weapon

.h

UPROPERTY(Category = WeaponMesh, VisibleAnywhere, BlueprintReadOnly)
	class UStaticMeshComponent* ItemMesh;
	
	void SetOwner(APSETPCCharacter* NewOwningPawn);

	/** Pawn which owns this weapon */
	UPROPERTY(Replicated)
	APSETPCCharacter* OwningPawn;

	/** Called when the weapon is equiped */
	void OnEquip();

	/** What to do when the weapon is spawned */
	void OnWeaponSpawn();

.cpp

void ABaseWeapon::SetOwner(APSETPCCharacter* NewOwningPawn)
{
	OwningPawn = NewOwningPawn;
}

void ABaseWeapon::OnEquip()
{
	/** Do weapon equip things bla */
	OnWeaponSpawn();
}

void ABaseWeapon::OnWeaponSpawn()
{
	if (OwningPawn->GetMesh())
	{
		if (OwningPawn->GetMesh())
		{
			ItemMesh->AttachTo(OwningPawn->GetMesh(), FName(TEXT("WeaponSocket_Rifle")));
	        }
		else
		{
			GEngine->AddOnScreenDebugMessage(-1, 25.0f, FColor::Yellow, "NoMesh");
		}
	}
	else
	{
		GEngine->AddOnScreenDebugMessage(-1, 25.0f, FColor::Yellow, "Nopawn");
	}
}

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

	DOREPLIFETIME(ABaseWeapon, OwningPawn);
}

AttachRootComponentTo(UsePawnMesh, AttachPoint, EAttachLocation::KeepRelativeOffset, true);

Makes it work… No idea why

Im having the same issue I ont know what to do:(