Anyone Have Any Idea Of How To Make A Leaderboard?
i have save data for my leaderstats already, i was wondering how to implement it into my code.
heres my savedata code.
01 | local DS = game:GetService( "DataStoreService" ):GetDataStore( "SaveMyData" ) |
02 | game.Players.PlayerAdded:Connect( function (player) |
04 | local playerkey = "id_" ..player.userId |
05 | local savevalue = player.leaderstats.Points |
06 | local savevalue 2 = player.leaderstats.Prestige |
08 | local GetSaved = DS:GetAsync(playerkey) |
10 | savevalue.Value = GetSaved [ 1 ] |
11 | savevalue 2. Value = GetSaved [ 2 ] |
13 | local NumbersForSaving = { savevalue.Value, savevalue 2. Value } |
14 | DS:GetAsync(playerkey, NumbersForSaving) |
18 | game.Players.PlayerRemoving:Connect( function (player) |
19 | DS:SetAsync( "id_" ..player.userId, { player.leaderstats.Points.Value, player.leaderstats.Prestige.Value } ) |
leaderstats
01 | game.Players.PlayerAdded:Connect( function (player) |
02 | local leaderstats = Instance.new( "Model" ) |
03 | leaderstats.Name = "leaderstats" |
04 | leaderstats.Parent = player |
06 | local money = Instance.new( "IntValue" ) |
09 | money.Parent = leaderstats |
10 | local money = Instance.new( "IntValue" ) |
11 | money.Name = ( "Prestige" ) |
13 | money.Parent = leaderstats |
14 | local money = Instance.new( "BoolValue" ) |
15 | money.Name = "DoublePass" |