Gamepass Door Script Not Working

So, I was trying to make a gp door which I thought was going to be simple but it didn’t :c


local debounce = true

script.Parent.Touched:Connect(function(hit)
	local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
	if player then
		if player:UserOwnsGamepassAsync(9122725) then
			if debounce == true then
				debounce = false
				script.Parent.Transparency = 1
				script.Parent.CanCollide = false
				wait(0.5)
				script.Parent.Transparency = 0
				script.Parent.CanCollide = true
				debounce = true
			end
		end
	end
end)

Please help me :sob:

1 Like

Please make sure to read the documentation available to you at developer.roblox.com. There is no such method as UserOwnsGamepassAsync on the player.

However, the method of MarketplaceService is indeed UserOwnsGamePassAsync (notice the uppercase “p”, “game pass” is two words, not one).

2 Likes

Hopefully this will work https://www.roblox.com/library/2688991714/Vip-Door
It’s a trusted and 100% safe model, you just find an Intvalue called GamepassID or something like that. The value property should be changed and replaced with the Gamepass ID.

1 Like

Sorry! I’m really tired and my scripting wasn’t working well XD

Thanks a lot :smiley: