Here's DataStore2 - In My Opinion, Better For Values
ServerScript Inside Of ServerScriptService
local DataStore2 = require(1936396537)
DataStore2.Combine("_GAME_DATA_","Points","Wins")
local defaultWins = 0
local defaultPoints = 0
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder",player)
leaderstats.Name = "leaderstats"
local wins = Instance.new("IntValue",leaderstats)
wins.Name = "Wins"
local points = Instance.new("IntValue",leaderstats)
points.Name = "Points"
local winsStore = DataStore2("Wins",player)
local pointsStore = DataStore2("Points",player)
local function updateWins(newWins)
player.leaderstats.Wins.Value = newWins
end
local function updatePoints(newPoints)
player.leaderstats.Points.Value = newPoints
end
updateWins(winsStore:Get(defaultWins))
updatePoints(pointsStore:Get(defaultPoints))
winsStore:OnUpdate(updateWins)
pointsStore:OnUpdate(updatePoints)
end)
Here's More Information To Use: https://kampfkarren.github.io/Roblox/api/
If you have anymore questions, comment down below and I'll be glad to help! If this worked, let me know by taking this as the solution. If it didn't comment down below what went wrong and I'll try to fix it for you.
~killerbrenden
1 comment
There's 2 options. ROBLOX DataStore OR Kampfkarren DataStore2 | I recommend DataStore2 for values (Bools, Ints, Strings, ETC.) and ROBLOX DataStore for tables (JSON, Dictionaries, ETC.) There are plenty of tutorials on youtube and resources for both of the datastores.