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 » Scripters
Home Search
 

Re: How do I make stuff save? [e.g. a shop]

Previous Thread :: Next Thread 
Klink45 is not online. 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 is not online. 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 is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
07 Apr 2015 02:24 PM
Datastore.


I script -~ chimmihc
Report Abuse
Klink45 is not online. 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
NovusTheory is not online. NovusTheory
Joined: 14 Oct 2009
Total Posts: 4532
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
cpmoderator12345 is not online. cpmoderator12345
Joined: 26 Jan 2013
Total Posts: 15651
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 is not online. 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
NovusTheory is not online. NovusTheory
Joined: 14 Oct 2009
Total Posts: 4532
07 Apr 2015 02:31 PM
:P

Yeah the wiki turned to mush with that


Total Posts: 404 ---------- Not Found
Report Abuse
cpmoderator12345 is not online. cpmoderator12345
Joined: 26 Jan 2013
Total Posts: 15651
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
NovusTheory is not online. NovusTheory
Joined: 14 Oct 2009
Total Posts: 4532
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
cpmoderator12345 is not online. cpmoderator12345
Joined: 26 Jan 2013
Total Posts: 15651
07 Apr 2015 02:35 PM
IK, but who cares

Save the plants! Plants > animals!
Report Abuse
Klink45 is not online. 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 is not online. 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
powerhotmail123 is not online. powerhotmail123
Joined: 11 Apr 2011
Total Posts: 5041
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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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
NovusTheory is not online. NovusTheory
Joined: 14 Oct 2009
Total Posts: 4532
08 Apr 2015 02:41 PM
When the button is pressed SetAsync() of the Data


Total Posts: 404 ---------- Not Found
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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