becourse im the only player and last player in my server to test it. it wont save my coins or gold or what ever. i even say print save in output but he even dont show that when i get out the game, so what am i doin wrong? and if u fand any other errors please let me know. thnx alot already
game.Players.PlayerRemoving:Connect(function(player)
local Character = player:WaitForChild("Character")
local LStats = player:WaitForChild("leaderstats")
local BackPack2 = player:WaitForChild("BackPack2")
local BackPack3 = BackPack2:WaitForChild("BackPack3")
local Ranking = player:WaitForChild("Ranking")
local Bank = player:WaitForChild("Bank")
print("Saving Player Data - ".. player.Name)
local IDForPlayer = "Stats-"..player.UserId
local level
if BackPack2.Helper.Value == true then
level = Character:FindFirstChild("Helper").Level
else
level = 1
end
local stats = {
Coins = LStats.Coins.Value;
Gold = LStats.Gold.Value;
Sand = BackPack3.Sand.Value;
Stone = BackPack3.Stone.Value;
MGold = BackPack3.MGold.Value;
BankValue = LStats.Bank.Value;
BankCoins = Bank.BankCoins.Value;
BankGold = Bank.BankGold.Value;
Rebirth = LStats.Rebirth.Value;
BackPackMaxValue = BackPack2.BackPack3MaxValue.Value;
Hammer = BackPack2.Hammer.Value;
PickAxe = BackPack2.PickAxe.Value;
Helper = BackPack2.Helper.Value;
HelperLevel = level;
Rank = Ranking.Rank.Value
}
ServerData:SetAsync(IDForPlayer, stats)
print (player.Name.." Data Saved")
end)
game:BindToClose(function(player)
game.Players.PlayerRemoving(player)
end)

2 comments
Wouldn't you loop through all the players in the BindToClose function?
thnx ur right. i looped through all the players on bindtoclose and this is what i needed. thnx for the help