Synthical
|
  |
| Joined: 06 Apr 2014 |
| Total Posts: 2075 |
|
|
| 27 Nov 2014 09:19 PM |
Scripters are no help, so I m coming here. So, I am trying to use data persistence, and it didn't work, here's the script: game.Players.PlayerAdded:connect(function(player) local leaderstats = Instance.new("Model", player) leaderstats.Name = "leaderstats" local Interest = Instance.new("IntValue", leaderstats) Interest.Name = "Bank" Interest.Value = 0 end) while wait(2.5) do for _,Player in pairs(game.Players:GetPlayers()) do if Player:FindFirstChild("leaderstats") then Player.leaderstats.Bank.Value = Player.leaderstats.Bank.Value +25 end end end game.Players.PlayerRemoving:connect(function(player) if player:FindFirstChild("leaderstats") then player:SaveNumber(player.leaderstats.Score.Value) end end) |
|
|
| Report Abuse |
|
|
slerps
|
  |
| Joined: 15 Nov 2013 |
| Total Posts: 5174 |
|
| |
|
Synthical
|
  |
| Joined: 06 Apr 2014 |
| Total Posts: 2075 |
|
|
| 27 Nov 2014 09:20 PM |
| Data Persistence confuses me. |
|
|
| Report Abuse |
|
|
Synthical
|
  |
| Joined: 06 Apr 2014 |
| Total Posts: 2075 |
|
|
| 27 Nov 2014 09:21 PM |
| I went to the wiki as well, and I couldn't figure it out. |
|
|
| Report Abuse |
|
|
slerps
|
  |
| Joined: 15 Nov 2013 |
| Total Posts: 5174 |
|
|
| 27 Nov 2014 09:21 PM |
| http://wiki.roblox.com/index.php?title=Data_persistence |
|
|
| Report Abuse |
|
|
slerps
|
  |
| Joined: 15 Nov 2013 |
| Total Posts: 5174 |
|
| |
|
hulkkid45
|
  |
| Joined: 16 Aug 2013 |
| Total Posts: 4724 |
|
|
| 27 Nov 2014 09:22 PM |
I don't know what to tell you.
Come here child, I will tickle you ༼ຈل͜ຈ༽ |
|
|
| Report Abuse |
|
|
|
| 27 Nov 2014 09:22 PM |
| im just learning basic math |
|
|
| Report Abuse |
|
|
Cindering
|
  |
| Joined: 28 Feb 2009 |
| Total Posts: 8171 |
|
|
| 27 Nov 2014 09:23 PM |
| Data persistence is obsolete. Look up Data Stores instead, they are more reliable and easier to use. |
|
|
| Report Abuse |
|
|
Synthical
|
  |
| Joined: 06 Apr 2014 |
| Total Posts: 2075 |
|
|
| 27 Nov 2014 09:23 PM |
| I went on that wiki as well, it doesn't make sense to me, if there was a full script of it, then I would maybe understand how it works. |
|
|
| Report Abuse |
|
|
Synthical
|
  |
| Joined: 06 Apr 2014 |
| Total Posts: 2075 |
|
|
| 27 Nov 2014 09:23 PM |
| Thanks Cindering, I'll try that. |
|
|
| Report Abuse |
|
|
Powerhalo
|
  |
| Joined: 16 Jun 2010 |
| Total Posts: 1504 |
|
|
| 27 Nov 2014 09:24 PM |
| Yep, don't use free models, they often use the outdated data persistence, data store allows much more freedom than data persistence. |
|
|
| Report Abuse |
|
|
Synthical
|
  |
| Joined: 06 Apr 2014 |
| Total Posts: 2075 |
|
|
| 27 Nov 2014 09:25 PM |
| Power, I scripted this my self. |
|
|
| Report Abuse |
|
|
Synthical
|
  |
| Joined: 06 Apr 2014 |
| Total Posts: 2075 |
|
|
| 27 Nov 2014 09:34 PM |
| Cindering, that looks more complicated. How would I tie my script into it? |
|
|
| Report Abuse |
|
|
Cindering
|
  |
| Joined: 28 Feb 2009 |
| Total Posts: 8171 |
|
|
| 27 Nov 2014 10:50 PM |
Data Stores give you pretty much unlimited storage to the server. You'd start by calling the service:
DataStoreService = game:GetService("DataStoreService")
then when a player joins, you can load their data:
local playerdata = DataStoreService:GetDataStore(player.userId.."_data")
You can hold all of the player's stats in this data store. Each value is saved as a "key" which you can refer back to later. If you wanted to load a player's "Bank" stat, you'd do:
local bank = playerdata:GetAsync("Bank") --loads the stat if bank == nil then --it will be nil the first time you load it bank = 0 end
and then assign that loaded value to the leaderstat that you will create. Data stores allow you to load and save values at any time, so you could add this to your loop to continuously save the value:
playerdata:IncrementAsync("Bank",25) --just keep in mind that there is a limit to data store requests per minute |
|
|
| Report Abuse |
|
|
kilerAK24
|
  |
| Joined: 01 Feb 2012 |
| Total Posts: 14 |
|
|
| 27 Nov 2014 11:13 PM |
| Not to sound like a newbie, but I would like to know what Async means. |
|
|
| Report Abuse |
|
|
Synthical
|
  |
| Joined: 06 Apr 2014 |
| Total Posts: 2075 |
|
|
| 27 Nov 2014 11:14 PM |
| @Cindering, what I want to know is, how do I put it into my script to save every time its value does up by 25? That is all I am wondering. |
|
|
| Report Abuse |
|
|
Synthical
|
  |
| Joined: 06 Apr 2014 |
| Total Posts: 2075 |
|
|
| 27 Nov 2014 11:17 PM |
| "Unknown Global player" Wtf? |
|
|
| Report Abuse |
|
|
Synthical
|
  |
| Joined: 06 Apr 2014 |
| Total Posts: 2075 |
|
|
| 27 Nov 2014 11:22 PM |
| I don't even get where to insert anything anymore, I am so lost right now. |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 28 Nov 2014 01:39 AM |
Async means Asynchronous It means that everything else carries on without it. |
|
|
| Report Abuse |
|
|
Powerhalo
|
  |
| Joined: 16 Jun 2010 |
| Total Posts: 1504 |
|
|
| 28 Nov 2014 05:47 PM |
| Synthical, it'll save the values when the player leaves, I don't see any reason to save it each 25 money. It'll slow the server for nothing. |
|
|
| Report Abuse |
|
|