|
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|