Hey,
I`m currently working on a Tycoon Saving System. I want when you leave the game and then Claim a new Tycoon that your Data is going to load in!
I save all purchased Objects in a Table with a String
Now I tried to save and load a Table but it dont work
Main Handler
local DataStoreService = game:GetService("DataStoreService")
local tbl = {}
local myDataStore = DataStoreService:GetDataStore("myDataStore")
--Object Data Saving
game.Players.PlayerRemoving:Connect(function(player)
local success, errormessage = pcall(function()
for i = 1, #tbl do
myDataStore:SetAsync(player.UserId.."-Objects",tbl[i].Name)
end
end)
if success then
print("Player Data successfully saved!")
else
print("There was an error when saving data")
warn(errormessage)
end
end)
Touch Handler (OnTouchDoor)
local tbl = {}
local DataStoreService = game:GetService("DataStoreService")
local myDataStore = DataStoreService:GetDataStore("myDataStore")
--Tycoon Load
local data
local success, errormessage = pcall(function()
data = myDataStore:GetAsync(plr.UserId.."-Objects")
end)
if success then
table.insert(tbl,data)
for i = 1, #tbl do
print(tbl[i].Name)
end
else
print("There was an error whilst getting your data")
warn(errormessage)
end
I hope somebody can help me

2 comments
check is the player has claimed their tycoon and if they have then give them the stuff
I not insetet the full script here i already have it :D