Download

Widget lag?

My client does the line trace and my server decreases the ammo when shot.



void AWeapon_Instant::Client_WeaponFire_Implementation()
{
    Super::WeaponFire();

//Line trace code

Server_Shoot_Info();

}




void AWeapon_Instant::Server_Shoot_Info_Implementation()
{
    //Decrease ammo when shot
    WeaponStats.CurrentInAClip--;

}


This function is bound to my current ammo text (Bp picture)

When i shoot on the server the ammo decreases instantly but when i shoot from the client the ammo decreases with delay like it is lagging. Gif of what i mean

Shooting from the server. This one works perfectly.

Shooting from the client on a dedicated server. This one has a slight delay as you can see it sometimes skips 2-3 numbers, how can i fix this.

I assume that value is being replicated down? In which case it may get bundled up, and stomped by further updates if they are within a very short time from each other.

The better approach is to just have Client count down its own ammo value (and if not currently shooting) have the authoritative server value stomp it from time to time.