MarketplaceService help

I dont know why, but this has always confused me, so if you could explain it to me as if I was a beginner that would be helpful.

This is my code:

image

I want something to happen after that BUT ONLY if the player has purchased the gamepass and didn’t cancel. How do I do that? Is it the same for developer items? Or is it different depending on the item?

1 Like

Try using (player, ID, wasPurchased).

wasPurchased is basically a boolean, and you can use it to check if the player bought the gamepass or clicked cancel.

if the player bought the gamepass, it will return true.

if the player cancelled the gamepass purchase, it will return false.

This means that you can check if the player bought the gamepass or cancelled it by using:

if wasPurchased == true then
    print("Player bought the gamepass successfully!")
    --Any other lines of code written here will run once the player buys the gamepass.
end

if wasPurchased == false then
    print("Player cancelled gamepass purchase!")
    --Any other lines of code written here will run once the player cancels the gamepass purchase.
end
1 Like

I finally understand it now! i can’t believe it confused me even after 2 years of coding

2 Likes

2 years of coding?

I’ve been coding for almost 5 months.

Now, I believe that everyone has different knowledges, regardless of their years of experience

1 Like

It’s probably because I barely ever use MarketPlaceService - i’ve used it about 3 maybe 4 times before in my years of coding

1 Like

i saw some guy claim that he has 10 years of luau experience but he created a new topic in “help and feedback” and he was wondering why LocalScript wouldnt run in Workspace :joy:

2 Likes

lmao

:rofl:
seriously who does that

[now please let me post, please.]

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.