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: Problems with PlayerRemoving

Previous Thread :: Next Thread 
Dragonboy00 is not online. Dragonboy00
Joined: 31 Aug 2008
Total Posts: 1753
04 May 2013 08:49 PM
So I have a function that saves a bunch of data persistence values when a player leaves. It works just fine when I call it while the player is there, but when I use it as a player leaves, it doesn't work.

It seemed to work when other players are there, rather than when it's only me testing. I think it may have to do with the server shutting down before the script has finished saving the values. How would I fix that?
Report Abuse
xXxMoNkEyMaNxXx is not online. xXxMoNkEyMaNxXx
Joined: 03 Oct 2008
Total Posts: 3120
04 May 2013 08:52 PM
Save button?
Report Abuse
chris1989 is not online. chris1989
Joined: 30 Nov 2007
Total Posts: 2520
04 May 2013 08:54 PM
Save on changed or auto save every few minutes or seconds
Report Abuse
notsopwnedg is not online. notsopwnedg
Joined: 07 Nov 2010
Total Posts: 4182
04 May 2013 08:55 PM
I would use the changed event on the leaderstats and save it when it changes.

Ex:

Save = function()
--Save All Stats
end

for _,n in next,Player.leaderstats:GetChildren() do
n.Changed:connect(Save)
end
Report Abuse
xXxMoNkEyMaNxXx is not online. xXxMoNkEyMaNxXx
Joined: 03 Oct 2008
Total Posts: 3120
04 May 2013 08:56 PM
I completely forgot that I did with metatables for my game :I
Report Abuse
Dragonboy00 is not online. Dragonboy00
Joined: 31 Aug 2008
Total Posts: 1753
04 May 2013 08:58 PM
Yeah, I was hoping to get to a solution without periodic saves, but it looks like it's the only answer.
Report Abuse
xXxMoNkEyMaNxXx is not online. xXxMoNkEyMaNxXx
Joined: 03 Oct 2008
Total Posts: 3120
04 May 2013 08:59 PM
So you're just going to ignore the suggestions that solve your problem?
Report Abuse
chris1989 is not online. chris1989
Joined: 30 Nov 2007
Total Posts: 2520
04 May 2013 09:00 PM
Are you useing values in the player or a global table full of variables?
Report Abuse
Dragonboy00 is not online. Dragonboy00
Joined: 31 Aug 2008
Total Posts: 1753
04 May 2013 09:03 PM
@Chris: In the player's backpack, but I clone it before I fetch and save, so it doesn't turn nil while I save

@MonkeyMan: Not at all. Periodic saves were suggested, and they'll probably be a bit less intensive than a connection to Changed, since some of these stats will be in constant flux.
Report Abuse
xXxMoNkEyMaNxXx is not online. xXxMoNkEyMaNxXx
Joined: 03 Oct 2008
Total Posts: 3120
04 May 2013 09:05 PM
Unless you're planning to change the values 30 times per second, connections (or metatables) would be the best way to go.
Report Abuse
Dragonboy00 is not online. Dragonboy00
Joined: 31 Aug 2008
Total Posts: 1753
04 May 2013 09:08 PM
I'll go with connections, then, since I have yet to teach myself metatables. Thank you all.
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