|
| 31 Jan 2013 05:16 PM |
I've attempted scripting them three times, it didn't work. I asked two scripting experts, neither of their suggestions worked either.
Does anyone mind telling me a good script of saving kills when you leave and come back?
A helpful response would be appriciated. Thanks for reading. |
|
|
| Report Abuse |
|
|
|
| 31 Jan 2013 05:18 PM |
Use DP.
player:SaveNumber("kills", 5) -- Change '5' to the number of kills to be saved. |
|
|
| Report Abuse |
|
|
|
| 31 Jan 2013 05:21 PM |
| Was I overthinking it? Is that the entire script? And by the way I need it to save wipeouts as well. |
|
|
| Report Abuse |
|
|
Quenty
|
  |
| Joined: 03 Sep 2009 |
| Total Posts: 9316 |
|
|
| 31 Jan 2013 05:22 PM |
No. You need to understand a bit on how leaderboards work...
http://wiki.roblox.com/index.php/Leaderboards
But your solution is data persistance. |
|
|
| Report Abuse |
|
|
|
| 31 Jan 2013 05:35 PM |
Well I know leader-boarding, and that link doesn't help, but thank you for your support. Anyone have a script/advice I can use? |
|
|
| Report Abuse |
|
|
| |
|
crouton04
|
  |
| Joined: 07 Jul 2010 |
| Total Posts: 4459 |
|
| |
|
| |
|
|
| 31 Jan 2013 05:53 PM |
Hope I don't sound like a noob with my bumps.
Bump3 |
|
|
| Report Abuse |
|
|
|
| 31 Jan 2013 06:01 PM |
| C'mon, please post? I really need help with this. |
|
|
| Report Abuse |
|
|
|
| 31 Jan 2013 06:03 PM |
Don't double post. This should work:
game.Players.PlayerAdded:connect(function(player) local stats=Instance.new("IntValue", player) stats.Name=="leaderstats" local s1=Instance.new("IntValue", stats) local s2=Instance.new("IntValue", stats) s1.Name, s2.Name="KOs", "WOs" if player.DataReady==true then s1.Value=player:LoadNumber("KOs") s2.Value=player:LoadNumber("WOs player.leaderstats.WOs) elseif player.DataReady==false then player:WaitForDataReady() s1.Value=player:LoadNumber("KOs") s2.Value=player:LoadNumber("WOs") end coroutine.resume(coroutine.create(function() while true do if player.DataReady==true then player:SaveNumber("KOs", player.leaderstats.KOs.Value) player:SaveNumber("WOs", player.leaderstats.WOs.Value) elseif player.DataReady==false then player:WaitForDataReady() player:SaveNumber("KOs", player.leaderstats.KOs.Value) player:SaveNumber("WOs", player.leaderstats.WOs.Value) end Wait(180) end end)) end) |
|
|
| Report Abuse |
|
|
|
| 31 Jan 2013 06:04 PM |
| There may be minor errors in that script, but they should be easily fixable through the output. The point is that that is what you're trying to do. |
|
|
| Report Abuse |
|
|
|
| 31 Jan 2013 06:10 PM |
A couple questions.
1. Does the wait(180) at the end have to be 180?
2. I fixed a few bugs, then it gave me an error that says: Workspace.Script:9: unfinished string near '"WOs player.leaderstats.WOs)'
Did you mean to have a string or not? I'm asking because of the one ". |
|
|
| Report Abuse |
|
|
|
| 31 Jan 2013 06:13 PM |
--No, it does not have to have the 180 remain 180. I recommend going by 30 second intervals at most though. Also, the error you said should be fixed.
game.Players.PlayerAdded:connect(function(player) local stats=Instance.new("IntValue", player) stats.Name=="leaderstats" local s1=Instance.new("IntValue", stats) local s2=Instance.new("IntValue", stats) s1.Name, s2.Name="KOs", "WOs" if player.DataReady==true then s1.Value=player:LoadNumber("KOs") s2.Value=player:LoadNumber("WOs") elseif player.DataReady==false then player:WaitForDataReady() s1.Value=player:LoadNumber("KOs") s2.Value=player:LoadNumber("WOs") end coroutine.resume(coroutine.create(function() while true do if player.DataReady==true then player:SaveNumber("KOs", player.leaderstats.KOs.Value) player:SaveNumber("WOs", player.leaderstats.WOs.Value) elseif player.DataReady==false then player:WaitForDataReady() player:SaveNumber("KOs", player.leaderstats.KOs.Value) player:SaveNumber("WOs", player.leaderstats.WOs.Value) end Wait(180) end end)) end) |
|
|
| Report Abuse |
|
|
|
| 31 Jan 2013 06:20 PM |
| Now the WOs don't show up. |
|
|
| Report Abuse |
|
|
|
| 31 Jan 2013 06:28 PM |
Accidentally added an extra = in the leaderstats name. Debugging your scripts in studio 2.0 helps, it has a live error checker.
game.Players.PlayerAdded:connect(function(player) local stats=Instance.new("IntValue", player) stats.Name="leaderstats" local s1=Instance.new("IntValue", stats) local s2=Instance.new("IntValue", stats) s1.Name, s2.Name="KOs", "WOs" if player.DataReady==true then s1.Value=player:LoadNumber("KOs") s2.Value=player:LoadNumber("WOs") elseif player.DataReady==false then player:WaitForDataReady() s1.Value=player:LoadNumber("KOs") s2.Value=player:LoadNumber("WOs") end coroutine.resume(coroutine.create(function() while true do if player.DataReady==true then player:SaveNumber("KOs", player.leaderstats.KOs.Value) player:SaveNumber("WOs", player.leaderstats.WOs.Value) elseif player.DataReady==false then player:WaitForDataReady() player:SaveNumber("KOs", player.leaderstats.KOs.Value) player:SaveNumber("WOs", player.leaderstats.WOs.Value) end Wait(180) end end)) end) |
|
|
| Report Abuse |
|
|
|
| 31 Jan 2013 06:46 PM |
| Now the WOs don't change when I die. Not sure about KOs, I don't have a player to test it with me. |
|
|
| Report Abuse |
|
|
|
| 31 Jan 2013 06:50 PM |
| The actual script isn't functional when you kill or die. That has to happen on your part. All you asked for was a script that saves stats. Not one that updates them. |
|
|
| Report Abuse |
|
|