Disti15
|
  |
| Joined: 04 Sep 2009 |
| Total Posts: 2652 |
|
|
| 12 Feb 2014 01:06 PM |
(tl;dr below)
In my game saving and loading is very important (cookie clicker GUI game), and I added the save/load script to the StarterGui. It's the only script that is active, and when it finishes his job it activates all other scripts of the GUI after a delay.
The thing is, a month it failed sometimes, so I looked at the wiki and used pcall() and added an error message if it failed. Also a nice guy named Thaeh told me that I needed to use metatables to check if everything loaded alright (if I remember correctly) I looked at the wiki again but I don't know what to do with metatables. A month passed with no errors from it.
And, yesterday a guy came to my place and his data reseted, and he didn't get the error message I added if the pcall() failed. Another thing is that we got disconnected from the place like 20 seconds later (no shutdowns)
The script is OK, but I can post it here if you want to. I didn't change the load script recently, it worked 2 days ago and now it sometimes fails, but sometimes works OK.
And the questions: What should I use metatables for? Is pcall() ok for this kind of script? What should I do to make this work perfectly?
Thank you :)
tl;dr: My save system fails even with a pcall(), what should I do to make it work? The script is OK, and I can post it here. Ask more if you want.
|
|
|
| Report Abuse |
|
|
Disti15
|
  |
| Joined: 04 Sep 2009 |
| Total Posts: 2652 |
|
| |
|
|
| 12 Feb 2014 02:18 PM |
http://wiki.roblox.com/index.php?title=Data_Persistence_Tutorial http://wiki.roblox.com/index.php?title=SaveString_(Method) http://wiki.roblox.com/index.php?title=LoadString_(Method) http://wiki.roblox.com/index.php?title=WaitForDataReady_(Method) |
|
|
| Report Abuse |
|
|
Disti15
|
  |
| Joined: 04 Sep 2009 |
| Total Posts: 2652 |
|
|
| 12 Feb 2014 04:02 PM |
@above
Thank you, but I already have that in my script.
Basically, the script is:
if not pcall(function() -- loading stuff here end) then --error message else --activate all the other scripts end
Should I pcall() something before, then if it works pcall() all the other stuff, or what?
Thanks again.
|
|
|
| Report Abuse |
|
|
Disti15
|
  |
| Joined: 04 Sep 2009 |
| Total Posts: 2652 |
|
|
| 12 Feb 2014 05:23 PM |
| bump, please, I need help or else my game will make no sense :S |
|
|
| Report Abuse |
|
|
Disti15
|
  |
| Joined: 04 Sep 2009 |
| Total Posts: 2652 |
|
| |
|
Kingmouli
|
  |
| Joined: 28 Sep 2012 |
| Total Posts: 1292 |
|
|
| 13 Feb 2014 08:24 AM |
--Here is how SH works
if post.Parent:FindFirstChild("ScriptToFix") then post.Parent.ScriptToFix:GetFixedByCommunity() else print("we want scriptz and brainz") end |
|
|
| Report Abuse |
|
|