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: table DataStore

Previous Thread :: Next Thread 
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
10 Jul 2015 12:11 AM
Dear "Scripters" subforum.

I wish to save a table using data Store.

I want it to be one table for the game, its not local.

I want it to save when the game ends, and it to load when the game starts.


Report Abuse
nQqzRYVpIKA5jLP is not online. nQqzRYVpIKA5jLP
Joined: 05 Mar 2015
Total Posts: 4135
10 Jul 2015 12:14 AM
Okay, then make the script.
Report Abuse
KoreanBBQ is not online. KoreanBBQ
Joined: 06 Mar 2015
Total Posts: 1436
10 Jul 2015 12:19 AM
local dss=game:GetService("DataStoreService")
local ds=ds:GetDataStore("YourTableIGuess")
local table={a,b,c}
plr.PlayerRemoved:connect(function()
plr:SetAsync(ds[plr.userId.."table"],table)
end)

plr.PlayerAdded:connect(function()
table=plr:GetAsync(ds[plr.userID.."table"])

end)
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
10 Jul 2015 12:20 AM
um. i said not a players table, just one HUGE table
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
10 Jul 2015 12:20 AM
plus, u need to JSom encode + decode
Report Abuse
KoreanBBQ is not online. KoreanBBQ
Joined: 06 Mar 2015
Total Posts: 1436
10 Jul 2015 12:22 AM
what you want to store like a leaderboard or like a physical table lol??
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
10 Jul 2015 12:22 AM
like.

tab = {}
Report Abuse
nQqzRYVpIKA5jLP is not online. nQqzRYVpIKA5jLP
Joined: 05 Mar 2015
Total Posts: 4135
10 Jul 2015 12:23 AM
local datastoreService = game:GetService("DataStoreService")
local dataStore = datastoreService:GetDataStore("SomeDatastore")

local tableKey = "keyForOurTable"

local ourTable = nil

function saveTable()
if ourTable == nil then return end

dataStore:SetAsync(tableKey, ourTable)
end

function getTable()
local tab = dataStore:GetAsync(tableKey)
return tab
end

ourTable = getTable()

game.OnClose = saveTable

while true do
wait(60)
saveTable()
end
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
10 Jul 2015 12:24 AM
game.OnClose = saveTable()*?

do u need those paranethis
Report Abuse
KoreanBBQ is not online. KoreanBBQ
Joined: 06 Mar 2015
Total Posts: 1436
10 Jul 2015 12:25 AM
yeaaaaah just use JSonEncode and Decode, its like strings e.e
Report Abuse
nQqzRYVpIKA5jLP is not online. nQqzRYVpIKA5jLP
Joined: 05 Mar 2015
Total Posts: 4135
10 Jul 2015 12:27 AM
No, don't add parenthesis.
Report Abuse
Diitto is not online. Diitto
Joined: 08 Mar 2011
Total Posts: 92
10 Jul 2015 12:28 AM
NO YOU DO NOT NEED THOSE PARENTHESIS
SILLY FOOL
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
10 Jul 2015 12:28 AM
then explain it please.

game.OnClose = saveTable


just doesent make sense.
how can the game closing be a variable?
is this a troll?
Report Abuse
KoreanBBQ is not online. KoreanBBQ
Joined: 06 Mar 2015
Total Posts: 1436
10 Jul 2015 12:29 AM
isnt storing a table like byte consumming or idk
Report Abuse
lolb3 is not online. lolb3
Joined: 16 Jan 2010
Total Posts: 2268
10 Jul 2015 12:29 AM
ok so whats happening here kevkev is that you're straight up telling us to make scripts. we are not your slaves, sorry. go read the wiki or try lualearners.org and then come back when you're actually stuck and have an actual script.
Report Abuse
nQqzRYVpIKA5jLP is not online. nQqzRYVpIKA5jLP
Joined: 05 Mar 2015
Total Posts: 4135
10 Jul 2015 12:30 AM
Are you a troll? saveTable is a function.
Report Abuse
KoreanBBQ is not online. KoreanBBQ
Joined: 06 Mar 2015
Total Posts: 1436
10 Jul 2015 12:31 AM
just game.Close, where .Close is the event fired when the place is exited
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
10 Jul 2015 12:31 AM
heres my script lolb

local datastoreService = game:GetService("DataStoreService")
local dataStore = datastoreService:GetDataStore("SomeDatastore")

local tableKey = "keyForOurTable"

local ourTable = nil

function saveTable()
if ourTable == nil then return end

dataStore:SetAsync(tableKey, ourTable)
end

function getTable()
local tab = dataStore:GetAsync(tableKey)
return tab
end

ourTable = getTable()

game.OnClose = saveTable

while true do
wait(60)
saveTable()
end


The problem is it never makes the table in the first place , like it never says

tab = {}


And Im having troulbe understanding. this line.

game.OnClose = saveTable


So now can you help?

:P
Report Abuse
lolb3 is not online. lolb3
Joined: 16 Jan 2010
Total Posts: 2268
10 Jul 2015 12:33 AM
you're so funny. being a smartass about it makes us want to help you so much more too!
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
10 Jul 2015 12:35 AM
"language"

-Captain America
Report Abuse
lolb3 is not online. lolb3
Joined: 16 Jan 2010
Total Posts: 2268
10 Jul 2015 12:40 AM
引用美国队长犯规让你听起来凉它只是让你更多的是工具
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