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: Saving Data

Previous Thread :: Next Thread 
Seeumliam is not online. Seeumliam
Joined: 06 May 2013
Total Posts: 5662
26 Jan 2015 12:56 PM
So I am trying this out, I don't know if I am doing it right, but what would I put in line six? would it be player:SaveString(...)

game.Players.PlayerRemoving:connect(function(player)
if player:WaitForDataReady() then
local inv = player.PlayerGui.Inventory.bk
local invdata = {inv.slots.one.Image, inv.slots.two.Image }
print(player.Name.."Left the game")
player:Save?
end
end)


~ Seeumliam ~
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
26 Jan 2015 12:57 PM
Lol Data persistance.

I have no idea how to use that thing.
Report Abuse
Seeumliam is not online. Seeumliam
Joined: 06 May 2013
Total Posts: 5662
26 Jan 2015 01:01 PM
See for the last week I have been telling myself to at least try, I have never made a table so trying one out, all it is suppose to do is save a table then I would use a script to load it when the player loads into the game.


~ Seeumliam ~
Report Abuse
IDKBlox is not online. IDKBlox
Joined: 05 Apr 2013
Total Posts: 1304
26 Jan 2015 01:17 PM
is it an int,bool or what? that you want to save?
Report Abuse
ChiefDelta is not online. ChiefDelta
Joined: 05 Nov 2010
Total Posts: 13071
26 Jan 2015 01:19 PM
Don't use data persistence, use data stores.

I remember the bad old days before data stores, but we're in better times....
Report Abuse
IDKBlox is not online. IDKBlox
Joined: 05 Apr 2013
Total Posts: 1304
26 Jan 2015 01:20 PM
Cheifdelta how do you used datastore?
Report Abuse
DrMathematica is not online. DrMathematica
Joined: 29 Aug 2008
Total Posts: 27268
26 Jan 2015 01:20 PM
Saving on PlayerRemoving? Yikes.

DataStores also help try to remove that habit. DataStore is much cleaner for saving - and should be used to break the habit of saving on PlayerRemoving.
Report Abuse
ChiefDelta is not online. ChiefDelta
Joined: 05 Nov 2010
Total Posts: 13071
26 Jan 2015 01:22 PM
@drmath

Lots of people use datastores to save on PlayerRemoving.

"Cheifdelta how do you used datastore?"

http://wiki.roblox.com/index.php?title=Data_store
Report Abuse
DrMathematica is not online. DrMathematica
Joined: 29 Aug 2008
Total Posts: 27268
26 Jan 2015 01:24 PM
@ChiefDelta

Mhm, but it's a bad habit. The issue is during disconnects. There's a big chance, when the player disconnects, PlayerRemoving will either not fire, or fire with missing data - leader to no data storage.

Also, the way DataStoring works is so clean, that it encourages constant saving. DataPersistence was very bulky and stored a bunch of requests to be sent when the player left (independent from when the game thought the player left on PlayerRemoving).
Report Abuse
IDKBlox is not online. IDKBlox
Joined: 05 Apr 2013
Total Posts: 1304
26 Jan 2015 01:24 PM
i have another question why do people but like the example_ the '_' at the end of the words? please explain
Report Abuse
ChiefDelta is not online. ChiefDelta
Joined: 05 Nov 2010
Total Posts: 13071
26 Jan 2015 01:26 PM
@drmath

what are you recommending instead, a loop to save data or saving everytime it's changed lol? (with a queue so you wouldnt go over the limit)


@idk
could be a number of reasons including string parsing, could just be garbage, could be spacing out for readability
Report Abuse
robocu3 is not online. robocu3
Joined: 13 Mar 2009
Total Posts: 6485
26 Jan 2015 01:26 PM
they're normally putting IDs after those
it looks better than say user0001. don't you think user_0001 is more readable?

-=Robo=-
Report Abuse
IDKBlox is not online. IDKBlox
Joined: 05 Apr 2013
Total Posts: 1304
26 Jan 2015 01:27 PM
oh alright thanks guys!
Report Abuse
preztonizer is not online. preztonizer
Joined: 22 Oct 2008
Total Posts: 375
26 Jan 2015 01:30 PM
I use .Changed for my data persistence instead of player removing that way every time their value/something gets added it saves automatically. i dont use data store seems difficult and i know data persistence so why change.
Report Abuse
DrMathematica is not online. DrMathematica
Joined: 29 Aug 2008
Total Posts: 27268
26 Jan 2015 01:30 PM
@ChiefDelta

Yes! That's correct. DataStore is not limited by how many requests can be used from a game, but per server. It's also affected by the number of players.

http://wiki.roblox.com/index.php?title=Data_store#Request_limit

Also, similar to MC (Mojang game), just save over intervals, not whenever it changes. That way you can be sure it always gets saved no matter if they lose connection or not.
Report Abuse
ChiefDelta is not online. ChiefDelta
Joined: 05 Nov 2010
Total Posts: 13071
26 Jan 2015 01:31 PM
i'm assuming you're also against saving data with game.OnClose?

Report Abuse
Seeumliam is not online. Seeumliam
Joined: 06 May 2013
Total Posts: 5662
26 Jan 2015 01:36 PM
So I looked up DataStore on the wiki, I am confused can you tell me how I could change this to be in dataStores?

game.Players.PlayerRemoving:connect(function(player)
if player:WaitForDataReady() then
local inv = player.PlayerGui.Inventory.bk
print(player.Name.."Left the game")
player:SaveNumber("S1", inv.slots.one.Value.Value)
end
end)


~ Seeumliam ~
Report Abuse
ChiefDelta is not online. ChiefDelta
Joined: 05 Nov 2010
Total Posts: 13071
26 Jan 2015 01:37 PM
You don't use WaitForDataReady for datastores.

Basically you use GetAsync, SetAsync, and a few UpdateAsyc calls to check if they have data previously saved, if they don't make them a key, if they do load their key.
Report Abuse
Seeumliam is not online. Seeumliam
Joined: 06 May 2013
Total Posts: 5662
26 Jan 2015 01:41 PM
for updating a inventory, how would I save it if I were not to do it when the player leaves?


~ Seeumliam ~
Report Abuse
Seeumliam is not online. Seeumliam
Joined: 06 May 2013
Total Posts: 5662
26 Jan 2015 02:03 PM
So I looked on the wiki and saw this example, can you explain how I would use my script above into this? I understand that the update part means every time the value of what I am saving updates it will save the new value.

local DataStore = game:GetService("DataStoreService"):GetDataStore("Test")

local connection = DataStore:OnUpdate("key", function(value)
print("the key was changed to " .. value)
end)

DataStore:SetAsync("key", 1)
DataStore:SetAsync("key", 2)

connection:disconnect()

DataStore:SetAsync("key", 3)


~ Seeumliam ~
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