Greetings!
I’m have a small problem here getting my server to send a message to the clients connected, I’m doing a small test with a flashlight toggle. Client can see the server’s flashlight on runtime, client can turn his own flashlight on/off and it gets replicated on both perfectly, but client can’t see when server toggles his flashlight on/off, what am I doing wrong? I have the code setup like I’ve seen multiple times already and it’s the same as the ShooterGame.
Here’s the code:
H:
protected:
virtual void FlashlightToggle();
UFUNCTION(Reliable, Server, WithValidation)
void SERVER_FlashlightToggle();
CPP:
void AProjectFrequencyCharacter::FlashlightToggle()
{
if (Flashlight)
{
Flashlight->ToggleVisibility();
if (Role < ROLE_Authority)
{
SERVER_FlashlightToggle();
}
}
}
bool AProjectFrequencyCharacter::SERVER_FlashlightToggle_Validate()
{
return true;
}
void AProjectFrequencyCharacter::SERVER_FlashlightToggle_Implementation()
{
FlashlightToggle();
}