|
| 10 Aug 2016 12:56 PM |
I'm making a game and I want the player to gain 10 coins every 1 minute.
I've already got the leaderboard script:
game.Players.PlayerAdded:connect(function(plr) local stats = Instance.new('IntValue', plr) stats.Name = 'leaderstats' local points = Instance.new('IntValue', stats) points.Name = 'Coins' points.Value = 0 end)
All I need to know now is how I can get the player to get 10 coins every 1 minute. Thanks.
|
|
|
| Report Abuse |
|
|
|
| 10 Aug 2016 01:04 PM |
While wait(60) do Players = game.Players:GetPlayers() for i, v in pairs(Players) do if v:FindFirstChild("leaderstats") do v.leaderstats.Coins.Value = v.leaderstats.Coins.Value + 10 end end end |
|
|
| Report Abuse |
|
|
| |
|
|
| 10 Aug 2016 01:06 PM |
| Put that script in ServerScriptService |
|
|
| Report Abuse |
|
|
| |
|
|
| 10 Aug 2016 01:15 PM |
| Did it give any error? Do you wait for a minute? |
|
|
| Report Abuse |
|
|
|
| 10 Aug 2016 02:05 PM |
game.Players.PlayerAdded:connect(function(plr) local stats = Instance.new('IntValue', plr) stats.Name = 'leaderstats' local points = Instance.new('IntValue', stats) points.Name = 'Coins' points.Value = 0 end)
while wait(60) do for i, v in pairs(game.Players:GetPlayers()) do if v:FindFirstChild("leaderstats") then v.leaderstats:WaitForChild("Coins").Value = v.leaderstats.Coins.Value + 10 end end end
You are not prepared. |
|
|
| Report Abuse |
|
|