Give money to a player ONCE, if has a gamepass

I have a Starting Pack gamepass that gives a player 1000 in-game cash, but i can’t figure out how to make it so the player gets the 1000 Cash once and never anymore.

Can anyone help me out?

This is the base script i’m using

local mps = game:GetService("MarketplaceService")
local gpID = 13261318

game.Players.PlayerAdded:Connect(function(plr)
	if mps:UserOwnsGamePassAsync(plr.UserId, gpID) then
		-- give cash
	end
end)
2 Likes

DataStores can help. You gotta learn them.

1 Like

You need to use a DataStore to save a boolean value representing that it’s already been given to the player.

2 Likes

If you want a player to be able to buy it more than once I recommend using a developer product instead of a game pass.

Well, for one you could do this off of a RemotEvent where when fired it will allow the gamepass cash to be claimed. (And for exploit prevention, you could also give them a storable item that can be tracked; and is not purchasable anywhere in game besides this pack.)

Then again, I recommend datastores.