So, i am trying to make a script that, once a player has a gamepass, it would give 50 money every minute.
Here's my script i've got so far..
DataStore = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
local plr = game.Players.LocalPlayer
game:GetService("MarketplaceService").ProcessReceipt = function(infoo)
local playerDPkey = infoo.PlayerId..":"..infoo.PurchaseId
if DataStore:GetAsync(playerDPkey) then
else
print(playerDPkey)
for i,v in pairs(game.Players:GetChildren()) do
if v.userId == infoo.PlayerId then
if infoo.ProductId == 667369456 then
plr.leaderstats.Value = plr.leaderstats.Value + 50 -- Gives 50 money
wait(70)
repeat
plr.leaderstats.Value = plr.leaderstats.Value + 50 -- Repeats
until
game.Players.LocalPlayer:ChildRemoved()
end
end
end
end
end
It doesn't add the money to the player.
If you think anything's wrong, let me know with an answer or a comment. Thanks!
