This is a question I've been thinking about for a long time. I'm currently working on one and I'd like to know how one would simulate "Placing objects" and more importantly, saving their placement.
Here were my ideas:
saving objects
Use DataStore tables I was thinking datastore tables may work because of how convenient it could be to save, as having two tables, one X and one Z storing data of what object is there and what rotation. (Both saved as ints).
The problem with this is that You wouldn't be able to save actual object existence (As Lumber Tycoon does) and you can only lock items into place. That brings me to my second theory:
Use :SaveInstance() This one seems more and less convenient in some ways. One inconvenience being that DataPersistance is depreciated. And I'm not exactly sure how this would work.
Building objects
Clone/MoveTo I was thinking about cloning objects from ReplicatedStorage based on the Mouses' hit.P. That's all I can think of.
Conclusion
Any and all help Is greatly appreciated...very greatly. Thanks so much to everyone for reading/answering in advance. Thanks!
Don't use DataPersistance
I know, it's convenient, right? You get to save all the Instances as they were and magic them back with a small command. Don't. It's wrong, temperamental, and above all else deprecated for a reason. That said, some games do use DataPersistance and I really hope that they lose their data and playerbase.
This bit is simple enough - For each asset in there, you save the object position of the Model's PrimaryPart, in the object space of some static element in the tycoon base. If the things are grid-aligned, you're doing even better because you only have to save the relative grid space that it exists in. You'll need to make sure you serialize the Vector3 values because Roblox won't do it for you.
Because all of your base elements are some form of a prebuilt asset which you're storing in your game somewhere, you can serialize its identity. That would be its internal name, for you. You can match this up with the position and you're pretty much there for saving all of the data.
It's probably not unlikely that your base stuff with have some kind of upgradeable elements which don't change the model used, only its individual metadata. Obviously, you can save that too. You'll just need to have to set it after you load in your base. Make sure that all of the data can be serialized in some form, and if it can't be saved directly then make sure you have an init script for the objects to deserialize the data when loading.
I think you should use data persistance in this case as it is depricated but in this case it is efficient because data stores have a request limit and you would never want to reach that so if the thing your trying to save is insignificant then just use data persistance (NOTE this does not mean you should always use data persistance, just use it on things that don't really matter if they get hacked or deleted.)