How do I make the leaderboard public?

So I’ve been doing a game with leaderstats, and the problem is I give players their strength through a local script, and it doesn’t update publicly, I can’t give it through a server script because I can’t access the “Local Player”, how do I give the player his stats and make them publicly visible?

You would need to use a RemoteEvent to pass the information from the client to the server which would update the leaderstats
You can learn about them on the API here:

It doesn’t work, if I use the remote event, I still have to access the client from a server script, how do I do it?

You cannot update stats locally and have it replicate to the server. You need to fire the server using a remote event which would then update the stats on the server.

Lol you just said that, I’m telling you that after it I have to give the player his stats from the server script, but I can’t say “game.Players.LocalPlayer” cuz “Local player” is only accessed by the local script

When you fire a remote event from the client the first value is always the player. That is how you would get the player.

1 Like

You can use the first argument on .OnServerEvent. This would be the player associated with the client that fired the event.

Edit: Beat me to it, haha.

What do you mean? Can you please send an example?

event.OnServerEvent:Connect(function(plr)
    print(plr.Name)
end)

Also make sure to secure your remote events by double checking inside the script.

This is not a really safe option. There are many ways to get the player without using Local Player: GetPlayerFromCharacter, PlayerAdded,etc. If you could explain why you are changing it to the client, we may be able to help you.

As long as the remotes are secured properly so that they aren’t able to be abused by exploiters, I don’t see why it would be an issue. There are definitely simpler ways to do it as you suggested, but overall I don’t think that it would be anything to worry about if they’re protected.