error MSB3075; error C2065: 'Role': undeclared identifier

Hello there.
I need help cause get stuck with a bunch of errors after created a class.
Before all was ok.

#include "CSGame/Public/Components/CSHealthComponent.h"
#include "GameFramework/Actor.h"
#include "GameFramework/GameMode.h"
#include "CSGame/Public/CSGameMode.h"
#include "Net/UnrealNetwork.h"
**// Called when the game starts
void UCSHealthComponent::BeginPlay()

    // Only hook if it is server
    if (Role == ROLE_Authority) {
        // This allows to subscribe to the player character
        AActor* MyOwner = GetOwner();
        if (MyOwner) {
            MyOwner->OnTakeAnyDamage.AddDynamic(this, &UCSHealthComponent::HandleTakeAnyDamage);

    CSHealth = DefaultHealth;

I have tried to change it to GetLocalRole() - the same issue
The second error is:

I have no idea what is wrong

Actor Components don’t have roles, the role is determined by the owning actor. You need to check the owers role.

Thank you a lot! Changed it to the GetOwnerRole() and it works. Btw if someone got the same errors, DONT!!! forget a semicolon at the end of the macros