I'm trying to make my leaderboard save my data but i don't understand https://developer.roblox.com/articles/Saving-Player-Data so can someone help me or make a script for me? here is my code: local players = game:GetService("Players") local leaderboardData = game:GetService("DataStoreService"):GetDataStore("LeaderStats")
local button = script.Parent game.Players.PlayerAdded:Connect(function(player) local leader = Instance.new("Model", player) leader.Name = "leaderstats" local cash = Instance.new("IntValue", leader) cash.Name = "Cash" local crimelevel = Instance.new("IntValue", leader) crimelevel.Name = "Crime Level" crimelevel.Value = 0 end) the code is located in SeverScriptService.

8 comments
first, you create "players" and don't use it, second you create "leaderboardData" and never use it
The code is located in ServerScriptService but
buttonis script.Parent?it was first in a button so that why that is the parent
the players and leaderboard data was because i tried already but didn't work i will remove those.
this is the new code: https://ibb.co/SrtN7Jm
so does anybody know the answer?
i vollowed the wiki (copied the last script) and it still doesn't work: https://ibb.co/ctQJtQ2 https://ibb.co/zrGfsVT https://ibb.co/NtxcCYn
new new code: https://pastebin.com/dJtSHcsr