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: Shutdown

Previous Thread :: Next Thread 
BloodLitch101 is not online. BloodLitch101
Joined: 13 Jul 2011
Total Posts: 941
18 Sep 2014 11:44 AM
Is it possible to save data when the server is shutdown? I started using a new method to update my values when the player leaves instead of using the .changed function. The .changed function works when the server shuts down, but no need to use that. If I use playerremoving, how could the values save on shutdown? I used this:

Game.OnClose = function()
wait(3)
end

That did not work.
Sorry for re-posting, no one last night new what to do.
Report Abuse
BloodLitch101 is not online. BloodLitch101
Joined: 13 Jul 2011
Total Posts: 941
18 Sep 2014 12:01 PM
No one?
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
18 Sep 2014 12:05 PM
Nobody.
I don't know, really. Just make sure you consistantly store the values you need to save on game shutdown and then update them on the datastore when OnClose is called.
Also game ~= Game
Report Abuse
Tynezz is not online. Tynezz
Joined: 28 Apr 2014
Total Posts: 4945
18 Sep 2014 12:05 PM
^Error
Game==game
Report Abuse
BloodLitch101 is not online. BloodLitch101
Joined: 13 Jul 2011
Total Posts: 941
18 Sep 2014 12:07 PM
I already tried storing the values on shut down. Did not work. How would nobody not know what to do...? Unless all the helpers are at school...
Report Abuse
Tynezz is not online. Tynezz
Joined: 28 Apr 2014
Total Posts: 4945
18 Sep 2014 12:11 PM
I'm 11 so really. I have no clue.
Report Abuse
Bobobob12 is not online. Bobobob12
Joined: 23 Jan 2008
Total Posts: 5350
18 Sep 2014 12:15 PM
game.OnClose:connect(function()
end)

you weren't running it through the event handler
Report Abuse
BloodLitch101 is not online. BloodLitch101
Joined: 13 Jul 2011
Total Posts: 941
18 Sep 2014 12:19 PM
Wait what? Does it matter where the code is placed? I'm sorry i'm a little confused.
Report Abuse
Bobobob12 is not online. Bobobob12
Joined: 23 Jan 2008
Total Posts: 5350
18 Sep 2014 12:20 PM
just like how a brick uses

script.Parent.Touched:connect(function()
end)

you need to connect the OnClose event the same way
Report Abuse
BloodLitch101 is not online. BloodLitch101
Joined: 13 Jul 2011
Total Posts: 941
18 Sep 2014 12:22 PM
Oh, thanks.
Report Abuse
BloodLitch101 is not online. BloodLitch101
Joined: 13 Jul 2011
Total Posts: 941
18 Sep 2014 12:32 PM
Game.OnClose:connect(function()
wait(3)
end)

Error: OnClose is a callback member of DataModel; you can only set the callback, get is not abailable?
Report Abuse
Bobobob12 is not online. Bobobob12
Joined: 23 Jan 2008
Total Posts: 5350
18 Sep 2014 12:37 PM
oh nevermind, you did implement it right since OnClose is just the callback

so the last player's stats aren't saving?
Report Abuse
BloodLitch101 is not online. BloodLitch101
Joined: 13 Jul 2011
Total Posts: 941
18 Sep 2014 12:40 PM
Yeah. I've been trying everything to see what I can do. I even tried a loop to save every 15 seconds but that would really be needed. The data saves when a player leaves. But if the server is getting forced to shutdown it does not count the player leaving. I was trying to use OnClose to maybe secure that problem but it seems to not be working well...
Report Abuse
robocu3 is not online. robocu3
Joined: 13 Mar 2009
Total Posts: 6485
18 Sep 2014 01:09 PM
I'm not sure OnClose even locally fires.
-=Robo=-
Report Abuse
BloodLitch101 is not online. BloodLitch101
Joined: 13 Jul 2011
Total Posts: 941
18 Sep 2014 01:12 PM
Whats the point of the wiki saying it should secure the data before shutdown then? Is their any other way to secure my data on shutdown?
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
18 Sep 2014 02:36 PM
OnClose() does not secure your data. You need to do that yourself.
OnClose() just runs something for up to 30 seconds before the server is allowed to shut down. You need to put all your code to save everything important in there. Also has to be on a server script in case you were being super silly
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