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 » Scripting Helpers
Home Search
 

Re: Data persistance help?

Previous Thread :: Next Thread 
drager980 is not online. drager980
Joined: 25 May 2009
Total Posts: 13385
14 Jan 2014 09:33 PM
yo i was making some saving jazz but then i realised i was terrible at it
this scripts broken, do any of you folks know why?
the goal of the save script is to when the button is pressed, save the contents inside "bought" and save the value of doge

the goal of load is to clear the contents of bought and replace them with the saved jazz
and replace doge value with the saved one

not really sure what the problem is
probably that i am awful at data persistance


Save:
a = script.Parent.Parent.doge
script.Parent.MouseButton1Up:connect(function()
if n == nil then
n = "obama"
x = script.Parent.Parent.Parent.Parent.Parent
x:WaitForDataReady()
z = script.Parent.Parent.bought:GetChildren()
x:SaveNumber("thebought", #z)
for i, yolo in pairs(z) do
pcall(function ()
x:SaveInstance(tostring(i), yolo)
end)
end
x:SaveNumber("doges", script.Parent.Parent.doge.Value)
script.Parent.Text = "saved"
wait(1)
script.Parent.Text = "save"
n = nil
end
end)

Load:
a = script.Parent.Parent.doge
script.Parent.MouseButton1Up:connect(function()
if n == nil then
n = "obama"
x = script.Parent.Parent.Parent.Parent.Parent
x:WaitForDataReady()
wipe = script.Parent.Parent.bought:GetChildren()
for i, batman in pairs(wipe) do
batman:remove()
end
local count = 0
pcall(function ()
count = player:LoadNumber("thebought")
end)
local z = {}
for i = 1, count do
pcall(function ()
z[#z + 1] = player:LoadInstance(tostring(i))
end)
end
for i, batman in pairs(z) do
local copy = batman:clone()
copy.Parent = script.Parent.Parent.bought
end
script.Parent.Parent.doge.Value = x:LoadNumber("doges")
script.Parent.Text = "saved"
wait(1)
script.Parent.Text = "save"
n = nil
end
end)
Report Abuse
drager980 is not online. drager980
Joined: 25 May 2009
Total Posts: 13385
14 Jan 2014 10:08 PM
b1
Report Abuse
drager980 is not online. drager980
Joined: 25 May 2009
Total Posts: 13385
14 Jan 2014 10:32 PM
b2
Report Abuse
drager980 is not online. drager980
Joined: 25 May 2009
Total Posts: 13385
14 Jan 2014 10:53 PM
b3
i see why people don't like dp
Report Abuse
drager980 is not online. drager980
Joined: 25 May 2009
Total Posts: 13385
14 Jan 2014 11:11 PM
b4
doesn't save/load items inside of bought
Report Abuse
drager980 is not online. drager980
Joined: 25 May 2009
Total Posts: 13385
15 Jan 2014 12:16 AM
b5
sad face
Report Abuse
drager980 is not online. drager980
Joined: 25 May 2009
Total Posts: 13385
15 Jan 2014 01:31 AM
b6
whyyy
Report Abuse
transIate is not online. transIate
Joined: 20 Jun 2013
Total Posts: 2699
15 Jan 2014 01:58 AM
y
Report Abuse
drager980 is not online. drager980
Joined: 25 May 2009
Total Posts: 13385
15 Jan 2014 02:11 AM
idk
y
Report Abuse
transIate is not online. transIate
Joined: 20 Jun 2013
Total Posts: 2699
15 Jan 2014 02:15 AM
wat u try to load/save btw
And also I am on mobile so excuse my dumbness
Report Abuse
drager980 is not online. drager980
Joined: 25 May 2009
Total Posts: 13385
15 Jan 2014 03:00 AM
the universe
someones items
and someones money
Report Abuse
juzzbyXfalcon is not online. juzzbyXfalcon
Joined: 02 Feb 2011
Total Posts: 1311
15 Jan 2014 03:26 AM
"the universe" <- but you're not actually using the universes data persistence API...

-Believe and you will achieve-
Report Abuse
drager980 is not online. drager980
Joined: 25 May 2009
Total Posts: 13385
15 Jan 2014 03:45 AM
i was joking ok
Report Abuse
DrHedgehogs is not online. DrHedgehogs
Joined: 07 Mar 2013
Total Posts: 11634
15 Jan 2014 04:36 AM
Ok
Report Abuse
drager980 is not online. drager980
Joined: 25 May 2009
Total Posts: 13385
15 Jan 2014 05:07 AM
so nobody wants to help?
lovely
Report Abuse
drager980 is not online. drager980
Joined: 25 May 2009
Total Posts: 13385
15 Jan 2014 03:52 PM
aah this is annoying
Report Abuse
drager980 is not online. drager980
Joined: 25 May 2009
Total Posts: 13385
15 Jan 2014 04:00 PM
aka main problems (probably) in each
x:WaitForDataReady()
z = script.Parent.Parent.bought:GetChildren()
x:SaveNumber("thebought", #z)
for i, yolo in pairs(z) do
pcall(function ()
x:SaveInstance(tostring(i), yolo)
end)
end

load:
x:WaitForDataReady()
wipe = script.Parent.Parent.bought:GetChildren()
for i, batman in pairs(wipe) do
batman:remove()
end
local count = 0
pcall(function ()
count = player:LoadNumber("thebought")
end)
local z = {}
for i = 1, count do
pcall(function ()
z[#z + 1] = player:LoadInstance(tostring(i))
end)
end
for i, batman in pairs(z) do
local copy = batman:clone()
copy.Parent = script.Parent.Parent.bought
end
Report Abuse
drager980 is not online. drager980
Joined: 25 May 2009
Total Posts: 13385
15 Jan 2014 06:39 PM
hellp
Report Abuse
drager980 is not online. drager980
Joined: 25 May 2009
Total Posts: 13385
15 Jan 2014 07:08 PM
so it looks like im never getting help
whoopdedoo
Report Abuse
drager980 is not online. drager980
Joined: 25 May 2009
Total Posts: 13385
16 Jan 2014 02:20 AM
the items don't like loading
but the savenumber and loadnumber work fine
maybe im just overcomplicating the item system
Report Abuse
OldGoldie is not online. OldGoldie
Joined: 17 Aug 2010
Total Posts: 8210
16 Jan 2014 02:22 AM
Not too fimilliar but i made a script to autosave tools from your backpack,
you could try doing save and load instance for the "items"
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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