generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Leaderboard script -- Whats wrong?

Previous Thread :: Next Thread 
BladeXE is not online. 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 is not online. 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 is not online. 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 is not online. 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
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
13 Apr 2014 12:32 PM
repeat
wait()
until
game.Players.NumPlayers >0
Report Abuse
BladeXE is not online. BladeXE
Joined: 22 Dec 2012
Total Posts: 3857
13 Apr 2014 01:32 PM
not helping
Report Abuse
Spongocardo is not online. Spongocardo
Joined: 06 Sep 2008
Total Posts: 2843
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image