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
 

Re: Help ##-Bug?

Previous Thread :: Next Thread 
Epic1230 is not online. Epic1230
Joined: 07 Dec 2011
Total Posts: 289
03 Aug 2013 12:35 PM
I've been trying to fix this leaderboard for days.. Nothing seems to happen. It doesn't clone any IntValue into the player..

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.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)
Report Abuse
Epic1230 is not online. Epic1230
Joined: 07 Dec 2011
Total Posts: 289
03 Aug 2013 12:42 PM
Anyone Help? :o
Report Abuse
Epic1230 is not online. Epic1230
Joined: 07 Dec 2011
Total Posts: 289
03 Aug 2013 12:59 PM
Bump..
Report Abuse
awsumpwner27 is not online. awsumpwner27
Joined: 03 Sep 2011
Total Posts: 4389
03 Aug 2013 01:01 PM
Have you tried testing it online? Here's an idea. Add a GUI to your place that turns green if the player has the Value, and red if not. Upload it as your place, and test it online. I didn't see any big errors, so this is the best idea I've got.
Report Abuse
slingy11 is not online. slingy11
Joined: 29 May 2011
Total Posts: 60
03 Aug 2013 01:05 PM
I've had this problem as well. I think when the function goes, the player isn't there so it doesn't put it anywhere. How about checking if the value exists every few seconds or frames and if it's not existent you make it again. That works for me, but I bet there's a better way somewhere
Report Abuse
Epic1230 is not online. Epic1230
Joined: 07 Dec 2011
Total Posts: 289
03 Aug 2013 01:17 PM
I've tested it online, where if the value does exist, the text says "Exists" and if it doesn't, it says "Error", and it only shows "Error".

Will this do the trick?
repeat wait() until newPlayer and newPlayer.Character
Report Abuse
Epic1230 is not online. Epic1230
Joined: 07 Dec 2011
Total Posts: 289
03 Aug 2013 01:20 PM
Should I do this?

repeat
local m = Instance.new("IntValue",newPlayer)
m.Name = "Minutes"
m.Value = 0
until newPlayer:FindFirstChild("Minutes")
Report Abuse
Epic1230 is not online. Epic1230
Joined: 07 Dec 2011
Total Posts: 289
03 Aug 2013 01:30 PM
Bump..
Report Abuse
Epic1230 is not online. Epic1230
Joined: 07 Dec 2011
Total Posts: 289
03 Aug 2013 01:59 PM
BUMP...
Report Abuse
Epic1230 is not online. Epic1230
Joined: 07 Dec 2011
Total Posts: 289
03 Aug 2013 02:01 PM
Bump..
Report Abuse
Epic1230 is not online. Epic1230
Joined: 07 Dec 2011
Total Posts: 289
03 Aug 2013 02:04 PM
Bumpity bump..
Report Abuse
slingy11 is not online. slingy11
Joined: 29 May 2011
Total Posts: 60
03 Aug 2013 04:46 PM
I guess that works, seems like a great idea. I'm going to try it out with my game.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
03 Aug 2013 05:08 PM
Try this: (LOL I helped you with this leaderboard c:)

function onPlayerEntered(newPlayer)
repeat wait(0) until newPlayer

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

newPlayer:WaitForDataReady()

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

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

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

end

game.Players.PlayerAdded:connect(onPlayerEntered)
Report Abuse
slingy11 is not online. slingy11
Joined: 29 May 2011
Total Posts: 60
03 Aug 2013 05:14 PM
Yep worked
Report Abuse
Vector2D is not online. Vector2D
Joined: 11 May 2013
Total Posts: 195
03 Aug 2013 05:24 PM
game:GetService('Players')['PlayerAdded']:connect(function(player)
player:WaitForDataReady();

if (not player:LoadInstance('leaderstats')) then
Instance.new('Model', player).Name = 'leaderstats';
Instance.new('IntValue', player).Name = 'Minutes';
end;

while wait(60) do
if (player) then
player.leaderstats.Minutes.Value = player.leaderstats.Minutes.Value + 1;
player:SaveInstance('leaderstats', player.leaderstats);
else
break;
end;
end;
end);
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