In the first script I made the table and DataStore
DataStore = game:GetService("DataStoreService"):GetDataStore("User")
game.Players.PlayerAdded:connect(function(Player)
local Leaderboard = Instance.new("IntValue", Player)
Leaderboard.Name = "leaderstats"
local Stage = Instance.new("IntValue", Leaderboard)
Stage.Name = "Stage's"
local Death = Instance.new("IntValue", Leaderboard)
Death.Name = "Death's"
local key = "Player:"..Player.userId
local SaveData = DataStore:GetAsync(key)
if SaveData then
Stage.Value = SaveData[1]
Death.Value = SaveData[2]
else
local Save = (Stage.Value , Death.Value)
DataStore:SetAsync(key, Save)
end
end)
But it Had a Error message saying:
Workspace.LinkedLeaderboard:20: ')' expected near ','
I also Have another script that save the player's stats every time they leave but that doesn't seem to work
DataStore = game:GetService("DataStoreService"):GetDataStore("User")
game.Players.PlayerRemoving:connect(function(Player)
local Save = (game.Player.leaderstats["Stage's"].Value , game.Player.leaderstats["Death's"].Value)
local key = "Player:"..Player.userId
DataStore:SetAsync(key, Save)
end)
The error message on this is script is:
Workspace.LinkedLeaderboard.Script:4: ')' expected near ','
If you want anymore information about the script please comment below! :)

1 comment
Thanks man!