So I want to make a cash system on the leaderboard which i got to work, but i want the cash to go up by 5 every 5 minutes if they buy the gamepass if they dont the cash rises by 1 every 10 minutes
I tried to script it it works fine in the studio Play Mode but in servers its not working..
wait (2)
amount = 1
waiting = 10
id = 929780083
for i,v in pairs(game.Players:GetPlayers()) do
if v then
if game:GetService("MarketplaceService"):PlayerOwnsAsset(v, id) then
v.PlayerGui.GuiMain.Enabled = true
while true do
wait(5)
v.leaderstats["Bakery Bucks"].Value = v.leaderstats["Bakery Bucks"].Value + amount * 5
end
else
amount = 1
v.leaderstats["Bakery Bucks"].Value = v.leaderstats["Bakery Bucks"].Value + amount
end
end
end

1 comment
Keep in mind, the code will only run once.