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: Help with table storing.

Previous Thread :: Next Thread 
Cybertek is not online. Cybertek
Joined: 29 May 2014
Total Posts: 18
17 Jul 2017 12:04 PM
local dss=game:GetService("DataStoreService")
local player=game:GetService("Players")
local HttpService=game:GetService("HttpService")

game.Players.PlayerAdded:connect(function(player)
local scope="player_"..player.UserId
local dsl=dss:GetDataStore("TableOfContents",scope)
local stats={}
stats.Endurance=10
stats.Hunger=100
end)


How can I store the table 'stats' into the datastore and then do a print(value of Hunger) when the player leaves the game?
Report Abuse
ChaoticRequiem is not online. ChaoticRequiem
Joined: 09 Dec 2011
Total Posts: 678
17 Jul 2017 12:07 PM
it's better to define your variable ### outside of playeradded since you might be using it in playerremoving for saving data
Report Abuse
LaeMVP is online. LaeMVP
Joined: 24 Jun 2013
Total Posts: 4416
17 Jul 2017 12:08 PM
[1] = Lua doesn't get triggered by white space, consider adding a few spaces so your code is a little more readable;
[2] = Connect not connect, the method connect is deprecated in favor of Connect;
[3] = What does giving the scope arg of GetDataStore do? I've never used it and I've never had any problems.
[4] = You could save an array to a datastore by doing, DataStoreExample:SetAsync(StringKey,{}) (That's just an example)
[5] = What are you feelings on Tuscany, I think it's a rather enjoyable location.
Report Abuse
Cybertek is not online. Cybertek
Joined: 29 May 2014
Total Posts: 18
17 Jul 2017 12:10 PM
no I want the table to be stored when the player connects, and when the player is removed I only want to print a specific row from the table, aka "Hunger".
Report Abuse
Cybertek is not online. Cybertek
Joined: 29 May 2014
Total Posts: 18
17 Jul 2017 12:32 PM
b1
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