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

How can I make a part give open a shop on touch?

I have a VIP door with a gamepass. I would like to know how I can make that door detect if a player does not have the gamepass and pop up a GUI to buy the pass.

Thank you!

1 answer

Here you go. Simple events and methods.

id = 1337 -- gamepass id

script.Parent.Touched:connect(function(hit)
	if hit.Parent and game.Players:GetPlayerFromCharacter(hit.Parent) then
		p = game.Players:GetPlayerFromCharacter(hit.Parent)
		if game:GetService("GamePassService"):PlayerHasPass(p, id) then
			script.Parent.CanCollide = false
			script.Parent.Transparency = 0.7
			wait(0.2)
			script.Parent.Transparency = 0
			script.Parent.CanCollide = true
		else
			game:GetService("MarketplaceService"):PromptPurchase(p,id)
		end
	end
end)

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