Since the UE4 Udemy course started it’s been some changes in the engine which may not be new to anyone coming this far, since we actually have been notice a fare amount of times. But anyway if your having problems with Unreal Engine 4.22 or maybe even older please add this two includes to ensure that GetWorld doesn’t give you an error:
#include “Engine/World.h”
#include “GameFramework/PlayerController.h”
also remember to remove the UPORPERTY(EditAnywhere) above your AActor if it doesn’t work. If you’re running a newer version of UE4 then of to google ya go