How would I check if a player brought the Dev Product?

How would I check if a player brought a dev product?

My Goal:

I want to wait until a player has brought a Developer Product after you function the request to purchase this Developer Product.

My Code:

Just in case you want/need to know the current code to prompt the Purchase request, I am providing code below:

local plr = game.Players.LocalPlayer
local button = script.Parent
local MarketplaceService = game:GetService("MarketplaceService")

script.Parent.MouseButton1Click:Connect(function()
	MarketplaceService:PromptProductPurchase(plr, 1070237496)
end)

Thanks for stopping by to help me, I apreaciate it!

2 Likes

This video explains it very well:

5 Likes

Okay, I will let you know if I am having issues with it!

2 Likes

For now, mark @SpacialEthanRB’s reply as solution. If it doesn’t work then reply back to him saying about that and unmark it as solution

Having a error;
image

My code;

( i think the error is on line 15 )

You used local player in a server script
Use the player from the receipt

Since it’s a server script, you cannot use game.Players.LocalPlayer. Replace that with your player variable instead.

Oh, thanks! I assumed that you could use it anywhere ( Now that I think about it there is no function that requires a player in that script )

2 Likes
if player then
    player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 5000
end

What do you mean by “there is no function that requires a player”?

In the separate code, there is no function the player has to activate, therefor you cannot do LocalPlayer

1 Like

Ok to me that makes no sense, I don’t understand what you mean.

What does that mean?

The script cant know what LocalPlayer value is

1 Like

I know that

1 Like