When a player buys something you should make it to add a value to a table
Then save that table as a Datastore.
So like this:
local DataStore = game:GetService("DataStoreService"):GetDataStore("TycoonSave")
local Http############################################local saveT = {}
function add(obj) -- Call this function when you buy something, obj is the object/model/button/as you choose
table.insert(saveT, obj.Name)
end
function saveTycoon(Player) -- Call this function when you wish to save a tycoon.
DataStore:SetAsync(Player.userId.."Tycoon", HttpService:JSONEncode(saveT))
end
function loadTycoon(Player) -- Call this function when you wish to save a tycoon.
saveT = HttpService:JSONDecode(DataStore:GetAsync(Player.userId.."Tycoon"))
if saveT ~= nil then
-- Now it can save and load, here it will have the table loaded with the names of the objects/models/buttons/as you choose, here you should do something to clone them ,that depends on your tycoon system.
end
end
Signed, eiad999 - ur_famous ~ Holder of India ~ Holder of India of development ~ Founder of Legends Studios ~ Developer of Stormcage Containment Facility... |