How to get player instance, if player is not in the game?

Hello.
So, I’m using the DataStore2 module and I need an actual player instance (not UserId) to get player data.
Is there any way to get that player instance?

I tried to use GetPlayerByUserId, but it doesn’t work. Is it possible to do that?

Thank you!

The reason GetPlayerByUserId doesn’t work is it’s meant for the service Players in the game. You can’t get a player instance from outside of the game.

i.e. you can’t get the player instance of someone who isn’t in your game

Oof, is there an alternative to get that data?

Here’s a post I found on how to access offline player’s data with DS2:

Looks like you can.

1). Simply save player KEYS to a separate datastore everytime a NEW player joins the game.

2). Then you can grab keys from your separate datastore, and use them to get data from within your players’ datastores.

(this will allow you create plugins and all sorts of other useful things to edit your players data within studio and ingame, even if the player is offline)

1 Like

I’m currently using OrderedDS saving some player data separately so I can make global leaderboard.

I’m using Combined DS2 if that matters, but I’ll take a look.

it should be the same logic then, you just gotta save the “keys” into a table within a datastore.

after you do that then you can use those keys to ‘unlock’ player data even when theyre offline.