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 to check if datastore exists???

Previous Thread :: Next Thread 
Craftwithcookie is not online. Craftwithcookie
Joined: 21 Dec 2012
Total Posts: 951
21 Sep 2016 12:10 PM
How do you check wheather there is a key "Idea_Dolan" in the datastore? The thing I am trying to do is have an idea box, but you can only put 1 idea in there, and i want to check wheather that datastore exist or no.
Report Abuse
FloweryMonkeyboy5 is not online. FloweryMonkeyboy5
Joined: 19 Sep 2012
Total Posts: 528
21 Sep 2016 12:19 PM
Simply try and read the key, if it doesn't exist the function will simply return nil.
Report Abuse
Craftwithcookie is not online. Craftwithcookie
Joined: 21 Dec 2012
Total Posts: 951
21 Sep 2016 12:25 PM
Would this work

if not DataStore:GetAsync("Idea_".. script.Parent.Parent.Parent.Parent.Parent.Name) == nil then
Report Abuse
Wunder_Wulfe is not online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
21 Sep 2016 12:34 PM
yes it returns the table stored or nil
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
21 Sep 2016 01:05 PM
local PlayerStats = {}

local UserId = Player.UserId

local Data = PlayerData:GetAsync(UserId)

if Data then PlayerStats = Data else PlayerData:SetAsync(UserId,PlayerStats) 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