UGameplayStatics::GetNumLocalPlayerControllers

Returns the number of fully initialized local players, this will be 0 on dedicated servers.