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
 

Leaderboards broke?

Previous Thread :: Next Thread 
Epic1230 is not online. Epic1230
Joined: 07 Dec 2011
Total Posts: 289
02 Aug 2013 07:46 PM
Are the leaderboards broken or is it just me? Beucase EVERY leaderboard I make doesn't work.. Even this simple one:

function onPlayerEntered(newPlayer)

local m = Instance.new("IntValue",newPlayer)
m.Name = "Minutes"
m.Value = 0

newPlayer:WaitForDataReady()

m.Value = newPlayer:LoadNumber("Minutes") or 0

m.Value.Changed:connect(function()
newPlayer:SaveNumber("Minutes",m.Value)
end)

while true do
wait(60)
m.Value = m.Value + 1
end

end

game.Players.PlayerAdded:connect(onPlayerEntered)
Report Abuse
WishNite is not online. WishNite
Joined: 11 Feb 2009
Total Posts: 15828
02 Aug 2013 07:50 PM
coroutine.resume(coroutine.create(function()
while true do
wait(60)
m.Value = m.Value + 1
end
end))

Try that.
Report Abuse
Epic1230 is not online. Epic1230
Joined: 07 Dec 2011
Total Posts: 289
02 Aug 2013 07:55 PM
Nope, doesn't work.
Report Abuse
WishNite is not online. WishNite
Joined: 11 Feb 2009
Total Posts: 15828
02 Aug 2013 07:57 PM
If you're testing in solo mode, PlayerAdded does not work.
Report Abuse
Epic1230 is not online. Epic1230
Joined: 07 Dec 2011
Total Posts: 289
02 Aug 2013 08:01 PM
I'm testing in game.
Report Abuse
Epic1230 is not online. Epic1230
Joined: 07 Dec 2011
Total Posts: 289
02 Aug 2013 08:02 PM
Here's the script that's supposed to show the minutes:

repeat wait() until game.Players.LocalPlayer:FindFirstChild("Minutes")

local m = game.Players.LocalPlayer.Minutes.Value

while wait() do
script.Parent.Text = "Time Spent: "..m.." Minutes"
end
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
02 Aug 2013 08:02 PM
Add a wait on the top
Report Abuse
Epic1230 is not online. Epic1230
Joined: 07 Dec 2011
Total Posts: 289
02 Aug 2013 08:10 PM
Still doesn't work.
Report Abuse
Epic1230 is not online. Epic1230
Joined: 07 Dec 2011
Total Posts: 289
02 Aug 2013 08:19 PM
Bump.. Also, is this happening to anyone else? Or is it just me?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
02 Aug 2013 08:21 PM
Post the new script with the wait
Report Abuse
kubuto2 is not online. kubuto2
Joined: 16 Jul 2008
Total Posts: 1275
02 Aug 2013 08:33 PM
function onPlayerEntered(newPlayer)

local leaderstats = Instance.new("Model")
leaderstats.Name = "leaderstats"

local m = Instance.new("IntValue", leaderstats)
m.Name = "Minutes"
m.Value = 0

newPlayer:WaitForDataReady()

m.Value = newPlayer:LoadNumber("Minutes") or 0

m.Value.Changed:connect(function()
newPlayer:SaveNumber("Minutes",m.Value)
end)

leaderstats.Parent = newPlayer

while true do
wait(60)
m.Value = m.Value + 1
end

end

game.Players.PlayerAdded:connect(onPlayerEntered)
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
02 Aug 2013 08:34 PM
Add a wait under the
"function onPlayerEntered(newPlayer)"
Report Abuse
Epic1230 is not online. Epic1230
Joined: 07 Dec 2011
Total Posts: 289
02 Aug 2013 08:34 PM
I don't want the leaderstats to be visible..
Report Abuse
Epic1230 is not online. Epic1230
Joined: 07 Dec 2011
Total Posts: 289
02 Aug 2013 08:38 PM
Added the wait, nothing happened.
Report Abuse
Epic1230 is not online. Epic1230
Joined: 07 Dec 2011
Total Posts: 289
02 Aug 2013 08:39 PM
Leaderboard:

function onPlayerEntered(newPlayer)

wait()

local m = Instance.new("IntValue",newPlayer)
m.Name = "Minutes"
m.Value = 0

newPlayer:WaitForDataReady()

m.Value = newPlayer:LoadNumber("Minutes") or 0

m.Value.Changed:connect(function()
newPlayer:SaveNumber("Minutes",m.Value)
end)

coroutine.resume(coroutine.create(function()
while true do
wait(60)
m.Value = m.Value + 1
end
end))

end

game.Players.PlayerAdded:connect(onPlayerEntered)

--------------------------------------------------------------------------------------------

The script that shows the time spent in the game:

repeat wait() until game.Players.LocalPlayer and game.Players.LocalPlayer:FindFirstChild("Minutes")

local m = game.Players.LocalPlayer.Minutes.Value

while wait() do
script.Parent.Text = "Time Spent: "..m.." Minutes"
end
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
02 Aug 2013 08:41 PM
"local m = game.Players.LocalPlayer.Minutes.Value"
Is the problem.

You are only getting m once, not every time it changes.
do:
"local m = game.Players.LocalPlayer.Minutes"
and in the loop, do:
.. m.Value ..
Report Abuse
Epic1230 is not online. Epic1230
Joined: 07 Dec 2011
Total Posts: 289
02 Aug 2013 08:46 PM
Nope.. Still doesn't work.. UGH, THIS IS GETTING FRUSTRATING.. I'VE BEEN SPENDING HOURS ON THIS LEADERBOARD .-.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
02 Aug 2013 08:49 PM
I feel like
"m.Value.Changed:connect(function()
newPlayer:SaveNumber("Minutes",m.Value)
end)"
should be
"m.Value.Changed:connect(function()
wait(0)
newPlayer:SaveNumber("Minutes",m.Value)
end)"

Otherwise, do you have TV/Join.me?
Report Abuse
jasondee1 is not online. jasondee1
Joined: 26 Jul 2008
Total Posts: 8002
02 Aug 2013 09:07 PM
I'm not a pro on leaderboard scripting but thats a awfully short leaderboard...

Most leaderboards I see have much more lines than that...

but i've never scripted a leaderboard before soooo....
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
02 Aug 2013 09:10 PM
It doesn't matter how long it is...

Here is a cash leaderboard:

Instance.new("IntValue", newPlayer).Name = "leaderstats"
Intsance.new("IntValue", newPlayer.leaderstats).Name = "Cash"
Report Abuse
Epic1230 is not online. Epic1230
Joined: 07 Dec 2011
Total Posts: 289
03 Aug 2013 06:54 AM
Bump..
Report Abuse
jasondee1 is not online. jasondee1
Joined: 26 Jul 2008
Total Posts: 8002
03 Aug 2013 05:18 PM
just grab a working "minutes played" leaderboard off of free models, noone minds (or notices) when you grab a small script off of free models
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
03 Aug 2013 05:21 PM
^^ noty
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