And whenever a player enters the game their data is imported into a single table made with the player’s name, and after the player leaves, if the server manages to save, the stored player’s data will be deleted, and if not, the server will repeat the attempt to save the data limited times or until the player data saves, however there is a problem, if the player data saving happen to fail and the player enters the same server, the player data e will not be able to be loaded nor accessed because the data will be deleted a short time after the player leaves, either until reaching a limit of attempts or at success on saving. Any suggestions to fix this issue?
Your question is very bulky and I’m missing the main query.
I suggest updating data in a 30 second interval and saving when player leaves or game closes.
Players.PlayerRemoving:Connect(function(Player) -- Will Save the Data of the player leaving
UpdateData(Player)
end)
game:BindToClose(function()
--//this function for saving data when game is shuting down
local players = Players:GetPlayers()
for _, Player in pairs(players) do
UpdateData(Player)
end
end)
that’s not what i am trying to say. What im trying to say is, if the player leaves and the player’s data saving fails, the server will retry until success (or limited times). but if the player rejoins that server, the server will not be able to load the data because you cant create tables with the same name, and then after the server reaches success or the limit of retry, the player’s data will be deleted from the server, and no script will be able to access that data.
Only, If it was stored on the server and left there. But normally you would remove this data when player leaves so
This is strange I think you believe the process of fetching data has more features than it actually has
something like that is created by the scripter. PlayerData would not just automatically be within the server until player leaves. unless a script does that.
Its not saving failure. Everything in my code is correct my friend, server-locking, attempts after save fails and many other things. what I say is. the player’s data is kept on the server until the player leaves and the server manages to save, if the server fails to save, it will try again limited times until success. however if the player re-enters the server while the server is retrying the save, the player’s data will be deleted even with the player in-game and will cause alot of errors in other scripts
If everything in your code is correct, then this issue shouldn’t happen. Why isn’t the server making the player wait until his/her data has been unlocked?
"the player re-enters the server while the server is retrying the save, the player’s data will be deleted"
You just need to look over your code specifically in those parts cant* really help without code examples only speculation and speculation can only get me so far