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

How to make a buy game pass pop up icon after touching the VIP door?

Asked by 3 years ago
Edited 3 years ago

I was trying to make a VIP room in my game, I've made it but there's a problem. How to make a game pass pop up icon if the player who didn't buy the game pass could buy it in-game? Thanks so much!

1 answer

Log in to vote
0
Answered by 3 years ago

Put a localscript in StarterGui with this code

local mps = game:GetService("MarketplaceService")
local gamepassId = 14837734
local door = game.Workspace.PremDoor
door.Touched:Connect(function(part)
    if part.Parent:FindFirstChildWhichIsA("Humanoid") then
        local plr = game:GetService("Players"):GetPlayerFromCharacter(part.Parent)
        local userId = plr.UserId
        if mps:UserOwnsGamePassAsync(userId, gamepassId) then
            --Run code if player owns the gamepass
        else
            mps:PromptGamePassPurchase(plr, gamepassId)
        end
    end
end)

0
tysm! nikitos54327 70 — 3y
0
can you explain the script? im having trouble with the marketplace service and the other stuff like the async and the prompt game pass purchase. Omq_ItzJasmin 666 — 3y
0
Change ur gamepass id and ur door nikitos54327 70 — 3y
Ad

Answer this question