Answered by
6 years ago Edited 6 years ago
You should keep all the real values somewhere that the client cannot access them. I personally use ServerStorage. Then you can have a Changed event linked to those values and make the leaderboard display them. Here is an example:
01 | game.Players.PlayerAdded:Connect( function (player) |
03 | local stats = Instance.new( "Folder" ) |
04 | stats.Name = "leaderstats" |
07 | local cash = Instance.new( "IntValue" ) |
11 | local playerFolder = Instance.new( "Folder" ) |
12 | playerFolder.Name = player.Name |
13 | playerFolder.Parent = ServerStorage |
15 | local serverCash = Instance.new( "IntValue" ) |
16 | serverCash.Name = "ServerCash" |
17 | serverCash.Parent = playerFolder |
19 | serverCash.Changed:Connect( function () |
21 | cash.Value = serverCash.Value |
Note: You will have to remember to :Destroy() the folder when the player leaves. else server storage could quickly be filled up with folders. Hope this helps and have a great day scripting!