Help with making a gamepass door

Oh ok. its fine. But thanks anyways!

No probem, i like to help people out :slight_smile:

Here, put this in a localscript in the door:

local ownsgamepass = game:GetService('MarketplaceService'):UserOwnsGamePassAsync(game.Players.LocalPlayer.UserId, PassID)`

script.Parent.Touched:Connect(function(hit)
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if plr == game.Players.LocalPlayer and ownsgamepass then
    script.Parent.CanCollide = false
    script.Parent.Transparency = 0.6
    wait(2)
    script.Parent.CanCollide = true
    script.Parent.Transparency = 0
end)

hi,

does this work the way I want it? Like if a person doesn’t have the gamepass they won’t see its transparency?

Yes, this should make it only transparent to the one player touching the door if they have the gamepass.

Hi,

I would like it so when the game starts that its already transparent and its can collide false. Can you do that?

Thanks,
Mista

Sure thing:

local ownsgamepass = game:GetService('MarketplaceService'):UserOwnsGamePassAsync(game.Players.LocalPlayer.UserId, PassID)`

game.Players.PlayerAdded:Connect(function()
    if ownsgamepass then
        script.Parent.CanCollide = false
        script.Parent.Transparency = 0
    end
end)

hi,

Where should I put my gamepass id?

thanks,
Mista

In the UserOwnsGamePassAsync function, replace PassId with the gamepasse’s id.

oh ok. Thankyou! Also I tried to do that but it underlines it likes theres something wrong.

Try removing the dash at the end of the first line. I think that’s the problem

ok I did. But the end) is still underlined

also the script doesn’t seem to work…

replace the end) with this:

    end
end)

I did that but the block is still can collide true and I put in a gamepass that I own. Ok got to go. Tell me when you find the answer!

Hey just curious, did this work for you?

Ok, put this in a LocalScript inside StarterPlayerScripts:

local Player = game.Players.LocalPlayer
local Marketplaceservice = game:GetService('MarketplaceService')
local door = game.Workspace.Door -- State the door

if Marketplaceservice:UserOwnsGamePassAsync(Player.UserId, PassId) then -- Replace PassId With the desired Id
door.Transparency = 0.6
door.CanCollide = false
end

If there are any instructions in the scripts then read them

Put a LocalScript in StarterPlayer > StarterPlayerScripts and change it to this
local DoorName = "TheDoorName" -- Specify your door name
local Player = script.Parent.Parent
local m = game:GetService('MarketplaceService')

local id = 0 -- Your Gamepass Id Here


if m:UserOwnsGamePassAsync(Player.UserId, id) then
	local Clone = game.ReplicatedStorage:WaitForChild(tostring(DoorName)) -- Don't worry about changing this 
	if Clone then
	local DoClone = Clone:Clone() -- Don't worry about changing this
	DoClone.Parent = workspace
		DoClone.Transparency = 0.6
		DoClone.CanCollide = false
	end
    else
	local NewClone = game.ReplicatedStorage:WaitForChild(tostring(DoorName))  -- Don't worry about changing this
	if NewClone then
		local Cloned = NewClone:Clone()  -- Don't worry about changing this
		Cloned.Parent = workspace
		Cloned.Transparency = 0
		Cloned.CanCollide = true
	end	
end	

Put a Script into the actual vip door and change the script to this
script.Parent.Parent = game.ReplicatedStorage

You can also use this if you don’t want to copy the scripts and stuff:
VIP_Door_Script.rbxm (2.2 KB)

Hope this helps!

2 Likes