capmun
|
  |
| Joined: 13 Sep 2015 |
| Total Posts: 161 |
|
|
| 05 Nov 2015 07:07 AM |
Anyone know how to save player's items with the use of Data Stores?
I created a working Data Store for an upcoming game that allows me to modify and or add infinite amounts of values to the game, but
I really need to know just how do you make the Data Store's save weapons? Or, how do you make a Data Store save a separate group of Values (which I can use to replicate the weapons)
Am I going to have to make another Data Store specifically for saving player's items while the other Data Store saves important game values? |
|
|
| Report Abuse |
|
|
capmun
|
  |
| Joined: 13 Sep 2015 |
| Total Posts: 161 |
|
| |
|
capmun
|
  |
| Joined: 13 Sep 2015 |
| Total Posts: 161 |
|
| |
|
capmun
|
  |
| Joined: 13 Sep 2015 |
| Total Posts: 161 |
|
| |
|
robocu3
|
  |
| Joined: 13 Mar 2009 |
| Total Posts: 6485 |
|
|
| 05 Nov 2015 07:28 AM |
well you could have a table saved called "weapons" it could contain strings for every weapon name the player currently owns the game could interpret that itself if you code it to, lol
-=Robo=- |
|
|
| Report Abuse |
|
|
capmun
|
  |
| Joined: 13 Sep 2015 |
| Total Posts: 161 |
|
|
| 05 Nov 2015 07:31 AM |
@robocu
I'm not good with loadstring and stuff so I don't really have good understanding of it though, I'll attempt
it would be nice if you could maybe give more info |
|
|
| Report Abuse |
|
|
robocu3
|
  |
| Joined: 13 Mar 2009 |
| Total Posts: 6485 |
|
|
| 05 Nov 2015 07:33 AM |
You wouldn't need loadstring. I'm confused on what you mean by items. Shouldn't a game have a set cache of weapons? I don't imagine you intend for players to build their own weapons. Is there a chance these weapons will be customized or something, is that the problem?
-=Robo=- |
|
|
| Report Abuse |
|
|
capmun
|
  |
| Joined: 13 Sep 2015 |
| Total Posts: 161 |
|
|
| 05 Nov 2015 07:34 AM |
No no, the weapon's aren't customized it's just weapons.
See what I want is for Player's items to be saved throughout the Universe, like when they leave and rejoin they'll have the items still.
I know how to do this using Data Persistence, but with Data Stores you can't use :SaveInstance()
|
|
|
| Report Abuse |
|
|
capmun
|
  |
| Joined: 13 Sep 2015 |
| Total Posts: 161 |
|
|
| 05 Nov 2015 07:35 AM |
| And I suppose they might be customized at one point, but at the moment no. |
|
|
| Report Abuse |
|
|
|
| 05 Nov 2015 07:36 AM |
What I would have done, not necessarily most efficient:
Put all tools in ServerStorage save tool names when player enters check his datastiore and load all strings he has there somethung like that gtg bye |
|
|
| Report Abuse |
|
|
capmun
|
  |
| Joined: 13 Sep 2015 |
| Total Posts: 161 |
|
|
| 05 Nov 2015 07:38 AM |
@Cynus
Yeah that's the problem I don't know how to save and load the weapons.
|
|
|
| Report Abuse |
|
|
robocu3
|
  |
| Joined: 13 Mar 2009 |
| Total Posts: 6485 |
|
|
| 05 Nov 2015 07:39 AM |
Cynus is on the right track. I'd personally have a folder of weapons under any given instance, and load it with that with the string names of the weapons. There's obviously more organized methods but it should get the job done.
-=Robo=- |
|
|
| Report Abuse |
|
|
robocu3
|
  |
| Joined: 13 Mar 2009 |
| Total Posts: 6485 |
|
|
| 05 Nov 2015 07:40 AM |
ohh, you don't know how to save at all here's a guide, should help you get how to approach this a little better http://wiki.roblox.com/index.php?title=Data_store
-=Robo=- |
|
|
| Report Abuse |
|
|
capmun
|
  |
| Joined: 13 Sep 2015 |
| Total Posts: 161 |
|
|
| 05 Nov 2015 07:42 AM |
So in the Data Store script I should have a table that contains the Tool Name of each weapon with the String Name of each weapon as well?
And the problem is I don't actually know how to Save them, like what would I have to do? |
|
|
| Report Abuse |
|
|
capmun
|
  |
| Joined: 13 Sep 2015 |
| Total Posts: 161 |
|
|
| 05 Nov 2015 07:43 AM |
@Robo
No, I know how to save Values I already have within the Data Store, I just don't know how to make it Check what the player owns then make it save that and load it when they join |
|
|
| Report Abuse |
|
|
robocu3
|
  |
| Joined: 13 Mar 2009 |
| Total Posts: 6485 |
|
|
| 05 Nov 2015 07:48 AM |
You require the datastore service... local ds = game:GetService("DataStoreService") then you get a datastore... local PlayerData = ds:GetDataStore("PlayerData") then you can write to it PlayerData:SetAsync(player.UserId, playerdata) you can also get it like this local weapons = PlayerData:GetAsync(player.UserId)
-=Robo=- |
|
|
| Report Abuse |
|
|
robocu3
|
  |
| Joined: 13 Mar 2009 |
| Total Posts: 6485 |
|
|
| 05 Nov 2015 07:48 AM |
i can't write it for you, homie, i'm trying to help as much as i can lol
-=Robo=- |
|
|
| Report Abuse |
|
|
|
| 05 Nov 2015 10:35 AM |
I wouldn't use the weapons name, instead I would assign an ID to that weapon and save that instead, reason? Integers generally take up less memory than strings.
Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784 |
|
|
| Report Abuse |
|
|
|
| 05 Nov 2015 10:37 AM |
| Premature optimization is the root of all evil, efficiency freak. |
|
|
| Report Abuse |
|
|
|
| 05 Nov 2015 10:38 AM |
http://www.roblox.com/Forum/ShowPost.aspx?PostID=176998794
Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784 |
|
|
| Report Abuse |
|
|
|
| 05 Nov 2015 10:43 AM |
You called my code ugly because it used a generic for loop e.e
|
|
|
| Report Abuse |
|
|
|
| 05 Nov 2015 11:15 AM |
That's because it is. ;)
Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784 |
|
|
| Report Abuse |
|
|
|
| 05 Nov 2015 11:17 AM |
It doesn't make a noticeable difference. It isn't like my table has 1 million elements ,bastard.
Now stop replying |
|
|
| Report Abuse |
|
|
|
| 05 Nov 2015 11:19 AM |
Heard of something called an "opinion"?
Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784 |
|
|
| Report Abuse |
|
|
|
| 05 Nov 2015 11:50 AM |
| Did you not hear me when I said to not reply? |
|
|
| Report Abuse |
|
|