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

How do I make a door that only players with a Game Pass can open?

Ok, yes, I know I asked this before, but I've stopped getting views and the answer I got didn't help. So I'm just asking it again. I just need it for the following game: https://web.roblox.com/games/4420473103/Redwood-Research-Base Can anybody please help me with this?

3 comments

0

I recommend that you go to the toolbox and fin a VIP door, you can copy the script from there. Just change the gamepassID to your own.

0

Yea, follow Itls you need to place VIP door and change in scipt door gamepass

0

We have a Problem there: I tried that but they didn't work

1 answer

Its easy. Just insert a script into your door then, Copy this

local MarketPlaceService = game:GetService("MarketplaceService")
local GamePassId = 214214897 -- Gamepass ID here.

local debounce = false

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		if debounce == false then
			debounce = true
			local player = game.Players:GetPlayerFromCharacter(hit.Parent)
			if MarketPlaceService:UserOwnsGamePassAsync(player.userId, GamePassId) then
				script.Parent.Transparency = 0.5 -- The visibility when it is open
				script.Parent.CanCollide = false -- Do not change or player will not be able to walk through
				wait(0.1)
				debounce = false
				wait(5) -- How long it stays open
				script.Parent.Transparency = 0 -- The true visibility of the door
				script.Parent.CanCollide = true -- Do not change or players that do not have the gamepass will be able to walk through
				
			
			end
			
			
			
			
			
			
		end
	end
end)

If the script does not work. Change the GamepassId to gamepassId

Please accept if this answer was helpful.

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