Trying to make a money Gamepass

Hello! I’m trying to make a Gamepass which will give you 100 Coins so players can buy money… but it doesn’t seem to work… can someone help me?

local MarketplaceService = game:GetService("MarketplaceService")
local DataStoreService = game:GetService("DataStoreService")
local currencyName = "Money"
game.Players.PlayerAdded:Connect(function(plr)
  if MarketplaceService:UserOwnsGamePassAsync(plr.UserId, 52622803) then
    plr.leaderstats[currencyName].Value = plr.leaderstats[currencyName].Value + 100
  end
end)

Are you getting any errors firstly?

Are you giving the correct gamepass id?

What type of script is this, regular or Local?

Can you print inside the event to see if it’s entering that part?

1 Like

I think what your looking for is a DevProduct. This will make it so that players can buy money multiple times. Documentation: Developer Products – In‑Game Purchases

Also, I believe this doesn’t work because this only adds the coins when the player FIRST JOINS and not when he buys (if he own the game pass)

3 Likes

Thanks!!!