I solved it by making the Interact() function check for authority, not the PlayerInput()
AMyCharacter.cpp
void AMyCharacter::Server_Interact_Implementation()
{
Interact();
}
void AMyCharacter::Interact()
{
if (HasAuthority())
{
* [bla bla bla]*
if (GetWorld()->LineTraceSingleByObjectType(
OutHit,
Start,
End,
FCollisionObjectQueryParams(ECollisionChannel::ECC_WorldStatic),
TraceParams))
{
AActor* HitActor = OutHit.GetActor();
ABaseElement* HitElement = Cast<ABaseElement>(HitActor);
if (HitElement)
{
** HitElement->PlayerInput();**
}
}
}
else
{
Server_Interact();
}
}
ABaseElement.cpp
void ABaseElement::PlayerInput()
{
* [bla bla bla]*
}