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
 

why use update async instead of set async

Previous Thread :: Next Thread 
Wowgnomes is not online. Wowgnomes
Joined: 27 Sep 2009
Total Posts: 26255
17 May 2016 09:59 PM
if i dont care about the old value
Report Abuse
Salinas23 is not online. Salinas23
Joined: 28 Dec 2008
Total Posts: 37141
17 May 2016 10:12 PM
You don't

you use SetAsync() if old value is not important
Report Abuse
Wowgnomes is not online. Wowgnomes
Joined: 27 Sep 2009
Total Posts: 26255
17 May 2016 10:24 PM
Ok thank you, I've never used datastore without having actual intValues attached to said thing so I'm a little out of my bounds

DateGnomeSeen = game:GetService("DataStoreService"):GetDataStore("SawAGnome")

How would I then create a child with the info?


local dateseen = 5 -- days since last sighting

DateGnomeSeen:GetAsync(player.UserId, dateseen)

Or would I need to create dateseen before saving it
Report Abuse
Wowgnomes is not online. Wowgnomes
Joined: 27 Sep 2009
Total Posts: 26255
17 May 2016 11:05 PM
bump
Report Abuse
Wowgnomes is not online. Wowgnomes
Joined: 27 Sep 2009
Total Posts: 26255
18 May 2016 12:10 AM
bimp
Report Abuse
xThe_Developer is not online. xThe_Developer
Joined: 07 Aug 2013
Total Posts: 585
18 May 2016 12:29 AM
If you truly want to be good and look professional.. And be neat about your scripts.. You need to gain a love for these three things.. functions, tables, and scopes


#code mod = require(sike) if not mod.xThe[...] then print("You're not RbxDev yet..") end
Report Abuse
xThe_Developer is not online. xThe_Developer
Joined: 07 Aug 2013
Total Posts: 585
18 May 2016 12:31 AM
You'd use GetAsync to get the key and SetAsync to save it.. You'd want to use UpdateAsync if you want it to have the greatest chance of successfully saving. << I have not attempted to use datastores.. But tables make it appear simple.


#code mod = require(sike) if not mod.xThe[...] then print("You're not RbxDev yet..") end
Report Abuse
Wowgnomes is not online. Wowgnomes
Joined: 27 Sep 2009
Total Posts: 26255
18 May 2016 12:31 AM
I'd agree, but think the best way for those are in time.

Not sure if my most recent question would be considered a function or scope question.
Report Abuse
xThe_Developer is not online. xThe_Developer
Joined: 07 Aug 2013
Total Posts: 585
18 May 2016 12:33 AM
You'd most likely want to use a table though, because you'd be able to save more things for the player in less space.


#code mod = require(sike) if not mod.xThe[...] then print("You're not RbxDev yet..") end
Report Abuse
Wowgnomes is not online. Wowgnomes
Joined: 27 Sep 2009
Total Posts: 26255
18 May 2016 12:34 AM
I am only trying to recall one value,

DateGnomeSeen = game:GetService("DataStoreService"):GetDataStore("SawAGnome")
local dateseen = 5 -- days since last sighting
--How would I then create a child with the info?
DateGnomeSeen:GetAsync(player.UserId, dateseen) --will this automatically create datseen which can be called upon later



Report Abuse
OldGoldie is not online. OldGoldie
Joined: 17 Aug 2010
Total Posts: 8210
18 May 2016 12:35 AM
I'm not the best at datastore, but I am gonna point out that it is userId.


Report Abuse
Wowgnomes is not online. Wowgnomes
Joined: 27 Sep 2009
Total Posts: 26255
18 May 2016 12:36 AM
isn't that what i have typed?
Report Abuse
xThe_Developer is not online. xThe_Developer
Joined: 07 Aug 2013
Total Posts: 585
18 May 2016 12:36 AM
I'm pretty sure it's more like...
DateGnomeSeen = game:GetServer("DataStoreService"):GetDataStore("SawAGnome")
local dateseen = 5

key = DateGnomeSeen:GetAsync(player.UserId)
key:SetAsync(dateseen)


#code mod = require(sike) if not mod.xThe[...] then print("You're not RbxDev yet..") end
Report Abuse
xThe_Developer is not online. xThe_Developer
Joined: 07 Aug 2013
Total Posts: 585
18 May 2016 12:37 AM
oh yeh make player.UserId a string.. Keys can only be strings if i'm not mistaking


#code mod = require(sike) if not mod.xThe[...] then print("You're not RbxDev yet..") end
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