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
|
  |
| 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
|
  |
| Joined: 07 Dec 2011 |
| Total Posts: 289 |
|
| |
|
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
|
  |
| Joined: 07 Dec 2011 |
| Total Posts: 289 |
|
| |
|
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
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
Epic1230
|
  |
| Joined: 07 Dec 2011 |
| Total Posts: 289 |
|
| |
|
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
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 02 Aug 2013 08:21 PM |
| Post the new script with the wait |
|
|
| Report Abuse |
|
|
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
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 02 Aug 2013 08:34 PM |
Add a wait under the "function onPlayerEntered(newPlayer)" |
|
|
| Report Abuse |
|
|
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
|
  |
| Joined: 07 Dec 2011 |
| Total Posts: 289 |
|
|
| 02 Aug 2013 08:38 PM |
| Added the wait, nothing happened. |
|
|
| Report Abuse |
|
|
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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 07 Dec 2011 |
| Total Posts: 289 |
|
| |
|
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
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|