Hello. I am trying to make a datastore that saves a players tycoon. I have 0 idea of where to start, and dont even know how its going to work. I have a datastore for my leaderstats which was pretty easy, now I just need to implement it for the actual tycoon its self. If you could just tell me how to even go about it I would be very much in your debt, thank you fellow developers
I highly recommend this complete series:
I have never scripted any tycoons but thereâs a module I know that is able to convert an instance to a table or convert that table to an instance while keeping all the same properties the instance had before. Here it is: Converter Module: Instance â Table | Save Instances to DataStores and More!
I use it for my building game where players have plots and they could build stuff from blocks on them with different block shapes, colours and materials. This module has saved me so much time and brainstorms, I am very thankful for it even being a thing.
The best thing is that it works lightning fast and doesnât even lag.
Here are the features:
- Supports the DataStore/DataStore2 format.
- Supports object variablesâ .
- Supports Workspace and Lighting properties.
- Can be used without HTTP Service.
- Many customizable settings available.
- Complete backwards compatibility.
- Full attribute support.
- Supports ALL data types (CFrame, String, Vector3, UDim2, Ray, Faces, etc.)
- Compatible with the ModuleScripts created from the Instance to ModuleScript Converter plugin.
Holy, this is a god send. This actually might be the thing I use, thank you so much! Im going to go test this out.
Indeed it is, modules are really useful things and you should be thankful the community of Roblox developers are that creative and always exceed the limits trying new things out.
If you would like another solution besides the resource provided by @BandQueenForever, you would need to understand the concept of serializing data. You canât actually save instances like the parts of a tycoon but you can learn to serialize them. To serialize data you basically just need to save references to the instance that you are trying to save. Letâs say we have part of a wall in your tycoon and the player now has bought it. You can save that wall by saving its data. Instead of saving the entire instance you can save just the position or the name and then when the player loads into the game again, you can create a new part with the same position, size, name, and other important variables you would like to save. Serialization can come in handy when youâre trying to save data that you wouldnât be able to save normally.
I would like to know what data youâre trying to save so that I could provide a better example and better advice! If you already know about serialization then great! If you donât I found a good resource that helps you understand it.
I think the module I suggested does the same thing but when I was searching for a way to save plots and load them, I couldnât find anything simpler than the module. Of course, I found the serialization tutorial you linked but itâs just way too confusing (for me) and time wasting.
I just wanted to provide it since I think knowing how to serialize data can come in handy, but the module provided does seem good enough. Serialization can also be helpful when it comes to creating algorithms to compress and save space. If you can do that with the module you provided that would be fantastic!
Wow, that blew my mind. Pretty complex, but I think it might be worth using that over a module that might have bugs and other unwanted stuff
I have scripted a tycoon system before. I havenât gotten to any of the saving parts, but the way I designed it was for each tycoon
object, I have a function I can run to âpurchaseâ a part. I also have a table to identify which parts have been bought. I can save the table, and then purchase every part when the player obtains ownership of the tycoon.
Thanks for sharing the module @BandQueenForever but serialization might be the wrong approach for OP.
Hereâs a snippet from that module post:
The module is more-so intended for plot saving and sandbox builds.
In this case it looks like you only need something for a tycoon, which should be pretty straight forward. For a tycoon, youâll want to do something like @SubtotalAnt8185 said, save a unique name or id in a table for all the playerâs purchases, save that table to a DataStore, and give them their purchased structures/upgrades (using the unique id) when they claim a tycoon in their next session(s).
The playlist @Maks66606 linked seems to have a video for all the tycoon fundamentals including DataStores. If youâre just starting out, Iâd suggest giving those a watch to get a good understanding of how tycoon systems work.
I agree, this would be much simpler and would take much less space than serialization. I suppose if youâre making your Tycoon very modular and infinitely sized then serialization would be a better option but if the Tycoon is the same every time then it would be better to do something that wouldnât be as difficult or take as much space as serialization.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.