Trying to store data with DataStoreService when player leaves the game and its not working.. Here is the code for the values ( They are the same for each one just different values ) :
local PlayerNo = Instance.new("IntValue",folder)
PlayerNo.Name = "PlayerNumber"
PlayerNo.Value = PNo:GetAsync(player.UserId) or 11 -- 11 is just default if the player has no stored number
PNo:SetAsync(player.UserId, PlayerNo.Value)
and here is when players leave function:
game.Players.PlayerRemoving:Connect(function(player)
PN:SetAsync(player.UserId, player.PlayerName.PlayerN.Value)
PNo:SetAsync(player.UserId, player.PlayerName.PlayerNo.Value)
Pos:SetAsync(player.UserId, player.PlayerName.PlayerPos.Value)
Lang:SetAsync(player.UserId, player.PlayerName.PlayerLang.Value)
end)

2 comments
When the server shuts down PlayerRemoving will not fire so you also need to save data on BindToClose
Still not working budd.