You can still use the same base for it… Just with different aspects of it…
So lets say each button has a model in ServerStorage that it brings on once you buy it…
local Models = game:GetService("ServerStorage"):WaitForChild("Models") -- Replace with correct path
local datastore = game:GetService("DataStoreService"):GetDataStore("TycoonSave")
game.Players.PlayerAdded:Connect(function(plr)
local good, info = pcall(function()
return datastore:GetAsync(plr.UserId)
end)
if good then
for i,v in pairs(info) do
local model = Models[v]
--Load Model
end
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
local Tycoon = --Path to their tycoon
local InfoToSave = {}
for i,v in pairs(Tycoon.Models:GetChildren()) do
table.insert(InfoToSave, v.Name)
end
datastore:SetAsync(plr.UserId, InfoToSave)
end)
This is off the top of my head so their may be bugs…
This is mostly based off of assumptions… This will work if there is a model in the Tycoon called Models that contains each separate component…
If you have 0 scripting experience, I highly down you’ll be able to take this code and get it working… But after all, this category is not for free scripts… It should give you a place to start…
It’s way simpler than the original datastore and manages saving without overflowing your request there as never been a data loss with it, I suggest you check this to learn further I really recommend using it: How to use DataStore2 - Data Store caching and data loss prevention
What do you want me to update from the code? I tried your last one and it has a nil error, referring to the table not being declared yet, is there anything else you want to tell me?
I am still having trouble with my script, it will not load the tycoon up properly here is the script I am using:
ServerScript In ServerScriptService
local Models = game:GetService("Workspace"):WaitForChild("Chevy", "Wall1") -- Only Part Of The Items in The Tycoon
local datastore = game:GetService("DataStoreService"):GetDataStore("TycoonSave")
game.Players.PlayerAdded:Connect(function(plr)
wait(1)
local good, info = pcall(function()
return datastore:GetAsync(plr.UserId)
end)
if good then
for i,v in pairs(info) do
local model = Models[v]
print("Tycoon Loaded")
--Load Model
end
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
local Tycoon = workspace.VehicleDealershipTycoonKit.Factory
local InfoToSave = {}
for i,v in pairs(Tycoon.Models:GetChildren()) do
table.insert(InfoToSave, v.Name)
end
datastore:SetAsync(plr.UserId, InfoToSave)
print("Tycoon Saved")
end)
I didn’t put in the code to actually load the tycoon into the model since its against the rules to give the complete script… Basically its just going through all of the models and cloning and parenting the models.
You also want to have all of the models grouped together into a single model for that system to work… If you know basic lua, Im sure you can convert that code to work with your needs. It was just an example on how exactly its done.