This Is The Script
local datasevice = game:GetService("DataStoreService")
local mydatastore = datasevice:GetDataStore('MyDataStore')
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Parent = player
leaderstats.Name = "leaderstats"
local coins = Instance.new("NumberValue",leaderstats)
coins.Name = "Coins"
coins.Value = 100000
local multiplier = Instance.new("NumberValue",leaderstats)
multiplier.Name = "Multiplier"
multiplier.Value = 1
local dataC
local dataM
local success, errormessage = pcall(function()
dataC = mydatastore:GetAsync(player.UserId.."-Coins")
dataM = mydatastore:GetAsync(player.UserId.."-Multiplier")
end)
if success then
coins.Value = dataC
multiplier.Value = dataM
else
player.leaderstats.Multiplier.Value = 1
print("ERROR")
print(errormessage)
end
end)
game.Players.PlayerRemoving:Connect(function(player)
local success, errormessage = pcall(function()
mydatastore:SetAsync(player.UserId.."-Coins",player.leaderstats.Coins.Value)
mydatastore:SetAsync(player.UserId.."-Multiplier",player.leaderstats.Multiplier.Value)
end)
if success then
print("Data Success")
else
print("ERROR")
warn(errormessage)
end
end)