So i have this game and im trying to save many items before a player leaves the game but it is not able to save it all before the player leaves, so is there a faster way that i can save datastores? Heres the code.

game.Players.PlayerRemoving:connect(function(p)
local st = {p.RealGems.Value,p.SavedOre.Coal.Value,p.SavedOre.Iron.Value,p.VIPMaxXP.Value,p.VIPXP.Value,p.VIPLvl.Value,p.CodeStorage:FindFirstChild("N3wG@m3").Value,p.CodeStorage:FindFirstChild("@dm1nsRul3").Value,p.GoldMemberLeft.Value}
ds:SetAsync(p.Name.."key",st)
if p.OwnsTycoon.Value == true then
for i,Save in pairs(game.Workspace.Tycoon:FindFirstChild(p.TycoonOwned.Value).Purchases:GetChildren()) do
	p.ItemStorage:FindFirstChild(Save.Name).Value = true
	local s = {p.ItemStorage:FindFirstChild(Save.Name).Value}
	ds:SetAsync(p.Name.."key",s)
end
end
end)

5 comments

0

How about cloning those values to workspace, and then using the game:BindToClose() function to save all of their values...

0

well theres a tycoon for each player and game:BindToClose() only works if the game is going to shutdown.

0

and even if that worked there is only a 30 second cap.

0

which is not enough

0

Im pretty sure there is no way besides modifying your code.