Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 07 Apr 2015 02:03 PM |
| I've been trying to create a saving shop for a few days now, but how do I get it to save stuff? Could you please tell me what to do and how to do it? |
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 07 Apr 2015 02:19 PM |
| Why does nobody respond to my threads asking how to save? Is it really complicated? |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 07 Apr 2015 02:24 PM |
Datastore.
I script -~ chimmihc |
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 07 Apr 2015 02:27 PM |
| Yes I know, but how do I use DataStore? The wiki gives 0 examples. |
|
|
| Report Abuse |
|
|
|
| 07 Apr 2015 02:29 PM |
http://wiki.roblox.com/index.php?title=Data_store
They totally give 0 Examples
Total Posts: 404 ---------- Not Found |
|
|
| Report Abuse |
|
|
|
| 07 Apr 2015 02:29 PM |
local ds = game:GetService("DataStoreService") ds:GetAsync(var) -- name the variable you want to save ds:SetAsync(var, data) -- name the variable and the data you want to store
Save the plants! Plants > animals! |
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 07 Apr 2015 02:30 PM |
@Novus Thank you for that link, I was looking at one that was only showing properties! @cp Thank you for your example! |
|
|
| Report Abuse |
|
|
|
| 07 Apr 2015 02:31 PM |
:P
Yeah the wiki turned to mush with that
Total Posts: 404 ---------- Not Found |
|
|
| Report Abuse |
|
|
|
| 07 Apr 2015 02:31 PM |
yw but it might be wrong, i haven't used datastores in a while
Save the plants! Plants > animals! |
|
|
| Report Abuse |
|
|
|
| 07 Apr 2015 02:33 PM |
@cp
Oh and :GetAsync(Var) it's actually :GetAsync(Key) That's technically not a Variable
Total Posts: 404 ---------- Not Found |
|
|
| Report Abuse |
|
|
|
| 07 Apr 2015 02:35 PM |
IK, but who cares
Save the plants! Plants > animals! |
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 07 Apr 2015 02:36 PM |
| This is all sort of confusing, could you please explain to me what each part of your example does? I'm sorry if I'm being any trouble. |
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 07 Apr 2015 02:52 PM |
| Please? I still have no clue what the stuff even does and don't understand it. |
|
|
| Report Abuse |
|
|
|
| 07 Apr 2015 02:56 PM |
| Basically, the best way to do a shop is by using tables. Make a table full of the times you want in your shop, and have a bool value called something like 'IsPurchased'. If they buy it, set it to true. And then save the table using :SetAsync(), and retrieve it using :GetAsync(). |
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 07 Apr 2015 03:07 PM |
So something like
Data = { Sword = false; RocketLauncher = false; TimeBomb = false }
And then changing the false to true when purchased? I'm sorry if I'm really nooby (because I am) but how do I do that? |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 07 Apr 2015 03:10 PM |
player added
for i,v in next, all weapons do
if store:GetAsync(player.userId..v.Name) then give weapons
end end end
player leaving for i,v in next, things player has do if not (store:GetAsync(player.userId..v.Name)) then store:SetAsync(player.userId..v.Name,true) end end end
I script -~ chimmihc |
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 07 Apr 2015 03:11 PM |
@chim Ok, I get it, but how do I make it so it changes when a "weapon" is purchased? |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 07 Apr 2015 03:14 PM |
Save when they buy the weapon instead of when they leave.
I script -~ chimmihc |
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 07 Apr 2015 03:20 PM |
Ok, so if I say something like cp's way
local ds = game:GetService("DataStoreService") ds:GetAsync(Sword) -- name the variable you want to save ds:SetAsync(Sword, data) -- name the variable and the data you want to store
It will save the sword?
|
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 07 Apr 2015 03:26 PM |
| Sorry if that's too much to ask. |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 07 Apr 2015 03:27 PM |
It would be easier if I could get a copy of your shop, I can edit it to save and leave plenty of comments explaining it.
I script -~ chimmihc |
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 07 Apr 2015 03:31 PM |
Well, I haven't really "created" it yet, but here is my progress so far (there are 0 scripts that aren't in the rocket launcher) http://www.roblox.com/ShopGUI-item?id=235370684
Please don't change the way it looks, I just want it simply so when the "Buy" button is pressed it saves my data! And thanks in advance!
|
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 08 Apr 2015 02:03 PM |
| Well, looks like he never did it. Can somebody PLEASE explain to me how this works? |
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 08 Apr 2015 02:36 PM |
| Please somebody, it would be very generous of you. |
|
|
| Report Abuse |
|
|
|
| 08 Apr 2015 02:41 PM |
When the button is pressed SetAsync() of the Data
Total Posts: 404 ---------- Not Found |
|
|
| Report Abuse |
|
|