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 » Scripters
Home Search
 

Re: leaderstats Issue,

Previous Thread :: Next Thread 
PurelyMystic is not online. PurelyMystic
Joined: 24 May 2010
Total Posts: 931
04 Aug 2016 04:00 PM
I don't know why but it works in test mode with studio but in a server it doesn't work.
Here's the code...
game.Players.PlayerAdded:connect(function(plr)
local i = Instance.new("IntValue")
local v = Instance.new("IntValue")
v.Name = "Playtime(s)"
v.Parent = i
i.Name = "leaderstats"
i.Parent = plr
wait(1)
Playtime:GetAsync(plr.userId) -- It's a while true do that adds 1 every second to Playtime(s)
end)
game.Players.PlayerRemoving:connect(function(plr)
Playtime:SetAsync(plr.userId, plr.leaderstats["Playtime(s)"].Value)
end)


#code for i,v in pairs(game.Players:GetPlayers()) do v.Character:BreakJoints() end
Report Abuse
Soybeen is online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
04 Aug 2016 04:25 PM
I don't think you can call GetAsync every second for every player. The wiki is giving me problems right now so I can't go check its throttle, but I think you should just GetAsync their total playtime when they join, and save it when they leave.


Report Abuse
Kodran is not online. Kodran
Joined: 15 Aug 2013
Total Posts: 5330
04 Aug 2016 04:26 PM
Yeah you certainly shouldn't be using DataStores to transmit information between scripts.
Report Abuse
PurelyMystic is not online. PurelyMystic
Joined: 24 May 2010
Total Posts: 931
04 Aug 2016 04:35 PM
Wow I am dumb. I forgot to add v.Value = Playtime:GetAsync(plr.userId)
That issue is fixed.


#code for i,v in pairs(game.Players:GetPlayers()) do v.Character:BreakJoints() end
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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