Information: This works before now it doesn't No errors
local DSService = game:GetService("DataStoreService"):GetDataStore("Normalslots")
game.Players.PlayerAdded:connect(function(player)
local uniquekey = "id-"..player.userId
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local Clicks = Instance.new("IntValue")
Clicks.Name = "Clicks"
Clicks.Value = 0
Clicks.Parent = leaderstats
local Prestiges = Instance.new("IntValue")
Prestiges.Name = "Prestiges"
Prestiges.Value = 0
Prestiges.Parent = leaderstats
local Coins = Instance.new("IntValue")
Coins.Name = "Coins"
Coins.Value = 0
Coins.Parent = leaderstats
local Class = Instance.new("IntValue")
Class.Name = "Class"
Class.Value = 0
Class.Parent = leaderstats
local GetSaved = DSService:GetAsync(uniquekey)
if GetSaved then
Clicks.Value = GetSaved[1]
Prestiges.Value = GetSaved[2]
Coins.Value = GetSaved[3]
Class.Value = GetSaved[4]
else
local NumbersForSaving = {Clicks.Value, Prestiges.Value, Coins.Value, Class.Value}
DSService:SetAsync(uniquekey,NumbersForSaving)
end
end)
game.Players.PlayerRemoving:connect(function(player)
local uniquekey = "id-"..player.userId
local Savetable = {player.leaderstats.Clicks.Value, player.leaderstats.Prestiges.Value, player.leaderstats.Coins.Value, player.leaderstats.Class.Value}
DSService:SetAsync(uniquekey,Savetable)
end)
