I have been having some trouble with DataStore lately, I know it's possible to do it with a leaderboard, but how?
The value I want to save is called Points and it is located in a model called leaderstats inside a player.
Here is the script.
local playerStats = {} --this keeps a list of the stats for each player that enters the game
game.Players.PlayerAdded:connect(function(player) --Added function
local leaderstats = Instance.new("Model", player)
leaderstats.Name = "leaderstats"
local Points = Instance.new("StringValue", leaderstats)
Points.Name = "Points"
Points.Value = 0
local grouprank = Instance.new("StringValue", leaderstats)
grouprank.Name = "Rank"
local rank = player:GetRoleInGroup(1066846)
local rankn = player:GetRankInGroup(1066846)
grouprank.Value = rank
if rankn == 75 then
local team = game:GetService("Teams")
player.TeamColor = team.DJ.TeamColor
playerStats[player] = leaderstats
end
end)
--[[
-refrences-
leaderstats Model inside the player holding the values.
Points String value in the leaderstats model
Rank String value in the leaderstats model
--]]

2 comments
I do have a script that might help you out. It adds 50 points everytime a player joins. It saves and loads points . Its in my models on roblox, check it out
Well, I want to make it so the rank is a stat too, but not save that. And I don't want it to add 50 points, also I would like an explanation so I learn something. :)