Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Saving and Loading players 'House' to a plot of land?

Asked by
Cuvette 246 Moderation Voter
8 years ago

Right, before I go into detail. I don't want any scripts given to me but purely concepts or ideas. Thanks.

But yeah, I'm sure some of you have played 'Lumber Tycoon' where you can build on your land and when you next join you can select a plot of land and load up everything you've built.

I know you can save everything the player has into a model and load it up the next time they join using data stores/persistence, but how would I go about only letting them load their 'Model' (House) into a certain plot of land that hasn't been taken by another player.

And more importantly only letting them build on that plot of land.

If you have any suggestions that would be great!, Thanks, Cuv.

0
Well just put all their stuff into a model, the use :MoveTo() TranslateBy() or :SetPrimaryPartCFrame() to put all the players stuff onto their base. As for only letting them build on the base, use mouse.Target theCJarmy7 1293 — 8y
0
Well that was too simple, I think my brain just wasn't functioning well. Thanks though it's given me a quick insight on how to do it. Cuvette 246 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

Although I am not certain about saving functionality, I can help you with the building and claiming aspect of the plots.

Claiming/Assigning Plots To start you would need to have the plots that the player(s) will be building on in the Workspace. Each of the plots would have an IntValue inside of them to store an ID. You would then have a script that assigns the player a unique corresponding plot ID when they join. An example would be a script that creates an IntValue inside of the player when they join and sets it according to a table which contains the available plot ID's. When a player is assigned an ID for a plot, the script could remove that Id from the table, and when the player leave's the script would put the ID back into the table, allowing to be assigned to a different player.

Building On Assigned Plot For this, you could use a local script and a GUI (or some other form of selecting a block). Again, when the player joins you would assign them a build ID, but this time it would be a string. Using the local script, you could use a couple 'if' statements to detect if the player's mouse is touching the plot with the corresponding plotID using things such as mouse.Target. To place things, you would use a MouseButton1Down event and use :Clone to clone the part from the directory containing your buildables(parts you can build on your plot with). Use the build ID from the player to determine what part to clone.

Sorry if its confusing, the concept is a bit tricky to explain. Anyway, this is a concept I would use to go about building on assigned plots. As for the saving, I haven't ever messed with it so I wouldn't be a good source for information on saving\loading. Good luck with your project. :D

0
Thanks man, i've pretty much got everything working now and it's all looking quite nice. With the saving and loading, I saved all of the players parts and models into a model name "PlayerName's House" and used data persistance to load that up each time they claim a plot of land. Then whenever they select a part such as a roof or wall from my build GUI, it checks whether they've converted the wood Cuvette 246 — 8y
Ad

Answer this question