# Crouching not being replicated on dedicated server only

**URL:** <https://forums.unrealengine.com/t/crouching-not-being-replicated-on-dedicated-server-only/484228>\
**Category:** Multiplayer & Networking\
**Tags:** Networking, dedicated-server, crouch, unreal-engine, question\
**Created:** [June 1, 2021, 8:47am UTC](https://forums.unrealengine.com/t/crouching-not-being-replicated-on-dedicated-server-only/484228 "2021-06-01T08:47:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sh4rdKnight](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Sh4rdKnight](https://forums.unrealengine.com/u/Sh4rdKnight)\
**Post date:** [June 1, 2021, 8:47am UTC](https://forums.unrealengine.com/t/crouching-not-being-replicated-on-dedicated-server-only/484228/1 "2021-06-01T08:47:20Z")

</div>

I am using default CharacterMovementComponent with a custom Character class(Overrode only Tick, SetupPlayerInputComponent and EndPlay functions)

That’s how the crouching is handled.

```
void ACCharacter::BeginCrouch()
{
	if (!bDied)
	{
		Crouch();
	}
}

void ACCharacter::EndCrouch()
{
	if (!bDied)
	{
		UnCrouch();
	}
}

```

LineTrace happen on mouse click

```
		MyOwner = GetOwner();
            FVector EyeLocation;
		FRotator EyeRotation;
		// Trace the world, from pawn eyes to crosshair location
		MyOwner->GetActorEyesViewPoint(EyeLocation, EyeRotation);

		FVector LookDirection = EyeRotation.Vector();
		FVector TraceEnd = EyeLocation + (LookDirection * Range);

		FCollisionQueryParams QueryParams;
		QueryParams.AddIgnoredActor(MyOwner);
		QueryParams.AddIgnoredActor(this);
		QueryParams.bTraceComplex = true;
		QueryParams.bReturnPhysicalMaterial = true;

		// Particle target parameter
		FVector TracerEndPoint = TraceEnd;

		EPhysicalSurface SurfaceType = SurfaceType_Default;

		if (GetWorld()->LineTraceSingleByChannel(Hit, EyeLocation, TraceEnd, ECC_Camera, QueryParams))
		{
			DrawDebugLine(GetWorld(), EyeLocation, TraceEnd, FColor::White, false, 1.0f, 0, 1.0f);
		}

```

This is what I expect to happen and what happens on listen server:

![340378-listen.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/7/3/c73f6103dd53aa44a8476b8c5c3b2124e68d9af8.jpeg)

But this what happens if I use the same code on dedicated server:

 ![340379-dedicated.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/4/0/04084f220b7c469720a41b9f7eb49e033a87a9ca.png)

I am really unsure what could cause the code to only not work on dedicated server.

---

<div class="post-metadata">

**Author:** ![Sh4rdKnight](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Sh4rdKnight](https://forums.unrealengine.com/u/Sh4rdKnight)\
**Post date:** [June 1, 2021, 9:34am UTC](https://forums.unrealengine.com/t/crouching-not-being-replicated-on-dedicated-server-only/484228/2 "2021-06-01T09:34:22Z")

</div>

Fixed by changing the character’s mesh “Visibility based anim tick option” to AlwaysTickPoseAndRefreshBones.
