|
| 22 Feb 2013 07:31 AM |
| How do I save values when someone leaves and load when someone enter the game? |
|
|
| Report Abuse |
|
|
moryo7
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 5028 |
|
|
| 22 Feb 2013 07:35 AM |
| http://wiki.roblox.com/index.php/Data_persistence |
|
|
| Report Abuse |
|
|
cart6157
|
  |
| Joined: 28 Feb 2009 |
| Total Posts: 2194 |
|
|
| 22 Feb 2013 07:40 AM |
int = 1 game.Players.PlayerAdded:connect(function(p) p:WaitForDataReady() local num = p:LoadNumber("Num") int = num + 1 end)
game.Players.PlayerLeaving:connect(function(p) p:WaitForDataReady() p:SaveNumber("Num",int) end)
The int adds up everytime a player enters the server. |
|
|
| Report Abuse |
|
|
|
| 22 Feb 2013 07:59 AM |
| Does this also works at StringValues? |
|
|
| Report Abuse |
|
|
|
| 22 Feb 2013 09:47 AM |
Did you read the link the first reply gave you?
http://wiki.roblox.com/index.php/Data_persistence |
|
|
| Report Abuse |
|
|
|
| 22 Feb 2013 10:10 AM |
Yes I did. And now I'm stuck with a problem me and my friend can't solve. player:SaveString(player.Clan.Value)
|
|
|
| Report Abuse |
|
|
|
| 22 Feb 2013 10:34 AM |
| Tell me what you're trying to do. |
|
|
| Report Abuse |
|
|
|
| 22 Feb 2013 10:35 AM |
| Also, if you did read the wiki page I linked to you'd know that SaveString takes two arguments. |
|
|
| Report Abuse |
|
|
|
| 23 Feb 2013 01:56 AM |
| I'm trying to save a value of a StringValue who is add onplayerenter. And I'm dutch so I don't understand a lot of english. |
|
|
| Report Abuse |
|
|
bibo5o
|
  |
| Joined: 17 Jan 2009 |
| Total Posts: 414 |
|
|
| 23 Feb 2013 03:39 AM |
function onPlayerEntered(newPlayer) newPlayer:WaitForDataReady() wait(0.5) newPlayer.leaderstats.Candy.Value = newPlayer:LoadString("Clan") end
function onPlayerLeave(oldPlayer) oldPlayer:SaveNumber("Clan", oldPlayer.leaderstats.Clan.Value) end
game.Players.PlayerAdded:connect(onPlayerEntered) game.Players.PlayerRemoving:connect(onPlayerLeave)
they should work. |
|
|
| Report Abuse |
|
|