How to datastore a model

How would I use datastore (or an alternative) to save a 3d model. I’ve seen people do it. Retail tycoon, theme park tycoon, etc.

take the name of the model and store it. then retrieve the name of the model from the database to get the model. There is no way to store model in a database. not to my knowledge.

2 Likes

No I’m talking like whole maps to store. People build there own maps.

2 Likes

i have an idea how to do that but i can provide an in depth explanation at this time. Some else might assist you

2 Likes

So like plots? You can save the orientation and position of a part using CFrames, do CFrame:GetComponents() which will return all the values of the CFrame. Now you can save the orientation and the position of that part. This will be in worldspace however, so you can try to offset it by something like the worldpivot of a model for example.

Once it’s saved using getasync you should loop through the keys and values that were saved. You can also save other sorts of information about the part such as it’s name, brickcolor, size, etc.

Remember you can only save values in datastores, (e.g. integers/floats, booleans, strings, etc). So for vector3s for example you would need to do part.Size.X, part.Size.Y, part.Size.Z, save them like that.

2 Likes

(theoretically) You might be able to store the map in a variable, and then put the variable inside of the datastore.

Well I’m thinking about making a obby creator thing. But I may be able to do what fe2 (flood escape 2) did. fe2 made you upload it as a model. Then whenever you wanted to play it you put the id in them it will load it

https://devforum.roblox.com/t/saving-models-in-a-datastore/3058959?u=riccomiller

If you’re talking about saving pre-made models (like in retail tycoon 2), then you would just need to save the name and CFrame of the model (CFrame relative to the map’s origin). If you want to save completly custom models, then you could essentially do the same for every part in the model, possibly adding extra properties to save if needed (e.g ClassName, Color, Transparency, Decal/Mesh ID, etc)