The script im using below should work, Im just not sure if I should put the tycoon objects Ids into the save table, or how to put the tycoon purchases into the save tables at all.
`` local DataStoreService= game:GetService('DataStoreService'):GetDataStore("PretendCodeIsHere") local RunService = game:GetService("RunService") local db = 3 function SaveTableFunc(player) local SaveTable = { } return SaveTable end game.Players.PlayerAdded:connect(function(player) repeat wait() until player.Character repeat wait() until script:FindFirstChild("stats") local save1 = script.stats:Clone() save1.Parent = player local stats = player.stats local save = SaveTableFunc(player) local playerkey = "player-"..player.userId local SaveFiles = DataStoreService:GetAsync(playerkey) function dataInput(player, save) print("Got saved data for "..player.Name) end local Passed, Error = pcall(function() if SaveFiles == nil then print(player.Name.." has no save data yet") else dataInput(player, save) end end) if Error then print("***ERROR GETTING SAVE FILE FOR "..player.Name) local attempts = 0 while wait(db) do local retries = attempts + 1 attempts = retries local pass,err = pcall(function() if SaveFiles == nil then print(player.Name.." has no save data yet") else dataInput(player, save) end end) if pass or attempts == 5 then break end end end end) function SaveData(player) local Success,Error = pcall(function() local playerkey = "player-"..player.userId local save = SaveTableFunc(player) DataStoreService:SetAsync(playerkey,save) print("Saved data for "..player.Name) end) if Error then print("***ERROR SAVING DATA FOR "..player.Name) local attempts = 0 while wait (db) do local retries = attempts + 1 attempts = retries local pass,fail = pcall(function() local playerkey = "player-"..player.userId local data = SaveData(player) DataStoreService:SetAsync(playerkey,save) print("Successfully saved data for "..player.Name) end) if pass or attempts == 10 then break end end end end game.Players.PlayerRemoving:Connect(SaveData) game:BindToClose(function() if RunService:IsStudio() then return end local Players = game:GetService("Players") for _,player in pairs(Players:GetPlayers()) do SaveData(player) print("Saved data for "..player.Name.." on shutdown.") end end)``