Method for serializing a user's tycoon plot?

Was just wondering about the most ideal way to go about this. My question is basically what the best (and easiest) way to save a player’s tycoon plot would be. Like, in games where the user can freely build stuff on their plot, and position them, etc.

I know how to serialize it. Storing the types of objects, and their positions. However. My problem is mainly figuring out how the offset for each object would work. Because there’s no guarantee when the user plays again they’ll be on the same plot (if you know what I mean) so simply loading those objects’ stored positions will clearly not work.

Any idea for how to combat that problem? Thanks so much. Cheers.

1 Like

Maybe centre from the floor so you could probably get the offset from

plot.Floor.Position - obj.Position

And just save different objects with table’s and then when loading just clone and set the properties back to normal.

2 Likes

You could use HttpService JSON decode and encode functions that turn dictionarys into JSON string then can be converted back to dictionary.

Here is some of the documentation:

https://developer.roblox.com/en-us/api-reference/class/HttpService

local ObjectOffset = Plot.CFrame:ToObjectSpace(Object.CFrame)

then when loading:

Object.CFrame = Plot.CFrame * ObjectOffset
1 Like