|
| 23 Mar 2014 08:36 PM |
I have this script, it is not working, can someone troubleshoot?
game.Players.PlayerRemoving:connect(function(player) player:WaitForDataReady() player:SaveNumber("Pixels", player.leaderstats.Pixels.Value) end)
--To save
game.Players.PlayerAdded:connect(function(player) player:WaitForDataReady() print(player:LoadNumber("Pixels")) end) -- To load |
|
|
| Report Abuse |
|
|
| |
|
jonesj627
|
  |
| Joined: 06 Oct 2010 |
| Total Posts: 1496 |
|
|
| 23 Mar 2014 10:13 PM |
| use datastore, much easier |
|
|
| Report Abuse |
|
|
maxomega3
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 10668 |
|
|
| 23 Mar 2014 10:14 PM |
| Something to consider, but I don't see how it can be that much easier. |
|
|
| Report Abuse |
|
|
jonesj627
|
  |
| Joined: 06 Oct 2010 |
| Total Posts: 1496 |
|
|
| 23 Mar 2014 10:15 PM |
local DataStore = game:GetService("DataStoreService"):GetDataStore("Points") game.Players.PlayerAdded:connect(function(player) local key = "user_" .. player.userId --we want to give 50 points to users each time they visit DataStore:UpdateAsync(key, function(oldValue) local newValue = oldValue or 0 --oldValue might be nil newValue = newValue + 50 return newValue end) end) |
|
|
| Report Abuse |
|
|
jonesj627
|
  |
| Joined: 06 Oct 2010 |
| Total Posts: 1496 |
|
|
| 23 Mar 2014 10:16 PM |
| you don't even have to save stats when player leaves |
|
|
| Report Abuse |
|
|
maxomega3
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 10668 |
|
|
| 23 Mar 2014 10:29 PM |
| True, but it involves an entire function while the other just runs a service. How can that be more efficient? |
|
|
| Report Abuse |
|
|
|
| 24 Mar 2014 06:04 AM |
| Ok.. I just want to know how to fix the script I already have.. |
|
|
| Report Abuse |
|
|
vlekje513
|
  |
| Joined: 28 Dec 2010 |
| Total Posts: 9057 |
|
| |
|
Bebee2
|
  |
| Joined: 17 May 2009 |
| Total Posts: 3985 |
|
|
| 24 Mar 2014 06:18 AM |
How do you guys say it does not work without the MessageOut event or actually playing your game?
You guys never set anything from LoadString/LosdNumber |
|
|
| Report Abuse |
|
|
vlekje513
|
  |
| Joined: 28 Dec 2010 |
| Total Posts: 9057 |
|
| |
|
| |
|