Hello! I have been working on a new building system today. I followed a tutorial, so please do not comment about how you have seen the code on GamerM8’s channel!
I do have one request, please do NOT use this as open source. I know you can just go see the tutorial, but I request you just go watch the video. Write your own code!
What I want to achieve
I want to make it so the builds save, aswell I want to make it so you need enough cash to purchase it and you can only build on your plot! Is it possible?
What have I tried?
I have not attempted to do much yet, but I want to make the builds save, also, I want to put a price tag next to it! I also need to make it so
Your question has a pretty wide scope, but I’ll do my best to cover everything you asked about.
To save user data, you can use DataStoreService. Things like furniture, their position and orientation can be serialised into JSON objects. You can find resources for serialising things like CFrame data elsewhere on the Devforum.
For user-specific plots, you will need to create a system that keeps track of the existing plots and their owners. As for placing the furniture, you could have an invisible part to define the shape and size of the plot, and then use raycasting to figure out if the requested furniture position is within the bounds of the plot part.
The purchase mechanic seems to have already been handled by @Katrist while I was typing this.
Yeah! Could you show me how I would do that? I don’t know alot about raycasting. Do you mind showing me an example, or maybe how I would go about doing that for the code?
Documentation is your friend. I personally don’t currently have the time to implement it, but I recommend trying it out yourself as that’s the best (and the only good) way to learn. Or maybe someone else with more time on their hands will be able to do that.