local function playerRemoving(player) if player == tycoonOwner.Value then tycoonClone.Parent = game.Workspace.Tycoons for i, v in pairs(PurchasedItem:GetChildren()) do local itemClone = v:Clone() InfoToSave[itemClone.Name] = itemClone end print(InfoToSave) tycoon:Destroy() end playerData:SetAsync(player.UserId, InfoToSave) end
hello, im trying to make an autosave progress for my tycoon. But the problem is, it wont let me save the items in the datastore. What does the error means?
local function playerRemoving(player) if player == tycoonOwner.Value then tycoonClone.Parent = game.Workspace.Tycoons local InfoToSave = create_table(player) local success, err = pcall(function() local playerUserID = 'Player_'..player.UserId playerData:SetAsync(player.UserId, InfoToSave) end) if not success then warn("Could not save data") end print(InfoToSave) end tycoon:Destroy() end
I managed to fix it by doing this, but idk what's the problem before