Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I do the thing below?

Asked by 2 years ago

How do I check if a user has a game pass when a proximity prompt is fired, and if they don’t have it, prompt them to buy it?

1 answer

Log in to vote
1
Answered by
pwx 1581 Moderation Voter
2 years ago
Edited 2 years ago

For future reference, try and attempt it yourself before asking for help.

local Prompt = script.Parent
local MPS = game:GetService('MarketplaceService')
local gamepassID = 0 -- change to your gamepass

Prompt.Triggered:Connect(function(Player)
    if MPS:UserOwnsGamepassAsync(Player.UserId, gamepassID)
        -- do stuff
    else
        MPS:PromptGamePassPurchase(Player, gamepassID)
    end -- gamepass own check
end) -- onTriggered

Sources:

MarketplaceService

ProximityPrompt

0
Thanks so much! LeoPlaysGames_RBX 26 — 2y
Ad

Answer this question