Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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)

3 comments

0

tysm!

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.

0

Change ur gamepass id and ur door

This discussion is preserved as it was. New answers, comments, and votes are closed.