BladeXE
|
  |
| Joined: 22 Dec 2012 |
| Total Posts: 3857 |
|
|
| 13 Apr 2014 11:44 AM |
repeat wait() until game.Players.NumPlayers == game.Players.NumPlayers + 1
plrs = game.Players:GetPlayers()
for _,v in pairs(plrs) do if v.Leaderstats == nil then le = Instance.new("Model", player) le.name = "leaderstats" int = Instance.new("IntValue", le) int.Name = "Wins" int.Value = 0 int2 = Instance.new("IntValue", le) int.Name = "Kills" int.Value = 0 end end
game.Players.PlayerAdded:connect(function(p) p:LoadValue("Wins") p:LoadValue("Kills") end)
game.Players.PlayerRemoving:connect(function(rp) rp:SaveValue("Wins", rp.leaderstats.Wins.Value) rp:SaveValue("Kills", rp.leaderstats.Wins.Value) end)
I don't know where this errors If the player DOES NOT have a model called "leaderstats" in its player, the script creates one when the player joins, it loads their value from when the player leaves, it saves their value. |
|
|
| Report Abuse |
|
|
Trioxide
|
  |
| Joined: 29 Mar 2011 |
| Total Posts: 32902 |
|
|
| 13 Apr 2014 11:45 AM |
"repeat wait() until game.Players.NumPlayers == game.Players.NumPlayers + 1"
That is what is wrong. You're waiting until a number is bigger than itself. |
|
|
| Report Abuse |
|
|
BladeXE
|
  |
| Joined: 22 Dec 2012 |
| Total Posts: 3857 |
|
|
| 13 Apr 2014 11:50 AM |
exactly, so when the number of players is increased therefore a player joins |
|
|
| Report Abuse |
|
|
Trioxide
|
  |
| Joined: 29 Mar 2011 |
| Total Posts: 32902 |
|
|
| 13 Apr 2014 12:20 PM |
You're killing the logic, stop it.
You're still trying to do this: 1 == 1 + 1 |
|
|
| Report Abuse |
|
|
|
| 13 Apr 2014 12:32 PM |
repeat wait() until game.Players.NumPlayers >0 |
|
|
| Report Abuse |
|
|
BladeXE
|
  |
| Joined: 22 Dec 2012 |
| Total Posts: 3857 |
|
| |
|
|
| 13 Apr 2014 01:37 PM |
repeat wait() until game.Players.NumPlayers >= 1
plrs = game.Players:GetPlayers()
for _,v in pairs(plrs) do if v.Leaderstats == nil then le = Instance.new("Model", player) le.name = "leaderstats" int = Instance.new("IntValue", le) int.Name = "Wins" int.Value = 0 int2 = Instance.new("IntValue", le) int.Name = "Kills" int.Value = 0 end end
game.Players.PlayerAdded:connect(function(p) p:WaitForDataReady() p:WaitForChild("leaderstats") p.leaderstats.Wins.Value = p:LoadNumber("Wins") p.leaderstats.Kills.Value = p:LoadNumber("Kills") end)
game.Players.PlayerRemoving:connect(function(rp) rp:SaveNumber("Wins", rp.leaderstats.Wins.Value) rp:SaveNumber("Kills", rp.leaderstats.Kills.Value) end)
When life gives you lemons... BURN HIS HOUSE DOWN! >:D |
|
|
| Report Abuse |
|
|