How could I get a local player in a module script?

Hello there, I want to get leaderstats from a ModuleScript but in order to do that I need to get the LocalPlayer but when I do:

repeat wait(1) until game.Players.LocalPlayer

It Doesn’t work.

You can only use LocalPlayer in a module script if that module was require()'d by a local script.

1 Like

But Im using it for my DataStore and you can only call DataStoree’s in a Server Script.

Your data store functions should take a player as a parameter then.

You can’t access ‘LocalPlayer’ on the server because on the server there is no local player.

1 Like