How to get position of all players?

I cant use GetWorld() for some reason, it is “undefined”.
I have these headers there and it should work according to random internet guy #15687563

include “Engine/World.h”
include “GameFramework/PlayerController.h”
include “Runtime/Engine/Classes/Components/ActorComponent.h”

Any ideas why that is?