generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Game Design
Home Search
 

Re: How do I save something that the player builds?

Previous Thread :: Next Thread 
nikkog is not online. nikkog
Joined: 16 Nov 2006
Total Posts: 1124
21 Aug 2016 08:25 PM
How would i go about making a datastore that saves something that the player built?


Report Abuse
Weirdraidercs35 is not online. Weirdraidercs35
Joined: 14 May 2015
Total Posts: 2275
21 Aug 2016 08:32 PM
save place api


im a mlg
Report Abuse
nikkog is not online. nikkog
Joined: 16 Nov 2006
Total Posts: 1124
21 Aug 2016 08:33 PM
i dont want to save the whole place though


Report Abuse
pidgey is not online. pidgey
Joined: 16 Jan 2008
Total Posts: 2739
21 Aug 2016 08:35 PM
if everything is put into a model or folder then why not just save that into the datastore and parent it into workspace when loaded?


https://www.roblox.com/My/Groups.aspx?gid=2893266 | pidgey is my name sh##posting is my game https://www.roblox.com/money-item?id=13127780
Report Abuse
nikkog is not online. nikkog
Joined: 16 Nov 2006
Total Posts: 1124
21 Aug 2016 08:36 PM
@pidgey

never though of that, i'll try it


Report Abuse
nikkog is not online. nikkog
Joined: 16 Nov 2006
Total Posts: 1124
21 Aug 2016 09:15 PM
but i thought datastore can only save numbers though? how would i save something that isn't saved with a number?


Report Abuse
pidgey is not online. pidgey
Joined: 16 Jan 2008
Total Posts: 2739
21 Aug 2016 09:41 PM
it doesnt just save numbers???


https://www.roblox.com/My/Groups.aspx?gid=2893266 | pidgey is my name sh##posting is my game https://www.roblox.com/money-item?id=13127780
Report Abuse
nikkog is not online. nikkog
Joined: 16 Nov 2006
Total Posts: 1124
21 Aug 2016 09:42 PM
that's what i picked up from when i was reading through the wiki plus some tutorials.

i'm not sure how to save anything other that stats


Report Abuse
pidgey is not online. pidgey
Joined: 16 Jan 2008
Total Posts: 2739
21 Aug 2016 09:46 PM
"The value is the information you want to store or access. Values can be numbers, booleans, strings, or Lua tables."

ok so i was wrong, you cant save models/folders


https://www.roblox.com/My/Groups.aspx?gid=2893266 | pidgey is my name sh##posting is my game https://www.roblox.com/money-item?id=13127780
Report Abuse
pidgey is not online. pidgey
Joined: 16 Jan 2008
Total Posts: 2739
21 Aug 2016 09:47 PM
you can store arrays though, so just store the model inside an array

someone more familiar with datastore might help you


https://www.roblox.com/My/Groups.aspx?gid=2893266 | pidgey is my name sh##posting is my game https://www.roblox.com/money-item?id=13127780
Report Abuse
nikkog is not online. nikkog
Joined: 16 Nov 2006
Total Posts: 1124
21 Aug 2016 10:14 PM
bump


Report Abuse
qqtt991 is online. qqtt991
Joined: 14 Dec 2007
Total Posts: 1387
21 Aug 2016 11:05 PM
If the parts are anchored/loose, in theory you should be able to just store an array of arrays containing the part's name and it's relevant properties (size, cFrame position, cFrame rotation, type, etc), and when the player comes back, you could just rebuild the model based on the stored properties per part.

You would have to manually break up cFrame information into separate values, however.
There's also a /slight/ chance float values could lose precision when saved and result in bricks being off-grid when rebuilt later, which is completely unavoidable using this approach. I haven't tested this, however, so I can't say for certain whether or not that would happen.
I'm also pretty sure this wouldn't be able to handle connected faces (welds), but for anchored or loose parts it'd be just fine.

This structure could be extended into an array of arrays of arrays, so a player could have multiple models (An array of models, with a model being an array of parts, with a part being an array of properties, with complex properties being a sequence of values one after the other in the property array).


Report Abuse
qqtt991 is online. qqtt991
Joined: 14 Dec 2007
Total Posts: 1387
22 Aug 2016 12:19 AM
Here, I wrote a quick demo script showing off this idea.
https://www.roblox.com/Array-Based-Model-Saving-DEMO-item?id=485923190

Quicklink to sourcecode:
http://pastebin.com/1ciiYx67


Report Abuse
ServerDaddy is not online. ServerDaddy
Joined: 23 Aug 2015
Total Posts: 15857
22 Aug 2016 12:30 AM
ill try it out later .
Report Abuse
ServerDaddy is not online. ServerDaddy
Joined: 23 Aug 2015
Total Posts: 15857
22 Aug 2016 12:38 AM
liked .
Report Abuse
nikkog is not online. nikkog
Joined: 16 Nov 2006
Total Posts: 1124
22 Aug 2016 01:53 PM
hello serverdaddy
never seen you here before
Report Abuse
nikkog is not online. nikkog
Joined: 16 Nov 2006
Total Posts: 1124
22 Aug 2016 05:37 PM
i also got another idea, but i'm not 100% how to execute it
i heard that to save something like tools, you can just put a value inside of the tool to make it save.
but what if you had a script that put whatever the player built into a model, then gave that model a value with the player's id? wouldn't that allow you to retrieve the model later or not?


Report Abuse
nikkog is not online. nikkog
Joined: 16 Nov 2006
Total Posts: 1124
22 Aug 2016 07:44 PM
@qqtt
sorry but what do i do with the script to make it work? i tried it without success and i think i was doing something wrong


Report Abuse
qqtt991 is online. qqtt991
Joined: 14 Dec 2007
Total Posts: 1387
22 Aug 2016 08:32 PM
The script is more for concept's sake than for straight cut-and-paste implementation. You're intended to look at what the script is doing and apply the concept to a DataStore.

I don't have time right now to try and write the full code, sorry.


Basically for every player who joins the server, you want to create that 2D array. When the time comes to save the player's model, you'll have to find some way to collect all the parts of that player's model and group them together (be it in a model, or in an internal table). I would suggest just having every part a player makes automatically get parented to a model in Workspace called PLAYERID-Model or something unique to that player, to save time.

Then call an "encodeAndSave" function that converts the model into the appropriate format and saves it to the player's 2D array in the DataStore.

Then you'll need a function "decodeAndLoad" that's triggered by button or something that interprets the data saved to the player's array and rebuilds the model where you need it.


Report Abuse
nikkog is not online. nikkog
Joined: 16 Nov 2006
Total Posts: 1124
22 Aug 2016 08:45 PM
Alright. I think i'll take a break from trying to figure out datastores though until i have higher level lua knowledge


Report Abuse
qqtt991 is online. qqtt991
Joined: 14 Dec 2007
Total Posts: 1387
22 Aug 2016 08:48 PM
Tbh I'm doing the same thing lmao. I only came back to Roblox a couple of months ago.


Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Game Design
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image