i was trying to make a gamepass door script but it doesnt work
the script is parented to starterplayerscripts
--
local VipDoor = game.Workspace.VIPDoor
local player = game.Players.LocalPlayer
local gamepassId = 44709053 --- Change To Your Gamepass ID
local PlayerOwnGamepass = game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, gamepassId)
if PlayerOwnGamepass then
VipDoor.Transparency = 0.8
VipDoor.CanCollide = false
else
VipDoor.Transparency = 0
VipDoor.CanCollide = true
end
--
local VipDoor = game.Workspace.VIPDoor
local player = game.Players.LocalPlayer
local gamepassId = 44709053 --- Change To Your Gamepass ID
local success,error = pcall(function()
game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, gamepassId)
end)
if success then
print("Player owns gamepass")
VipDoor.Transparency = 0.8
VipDoor.CanCollide = false
else
warn("Player does not own gamepass")
VipDoor.Transparency = 0
VipDoor.CanCollide = true
end
Try printing some things, and see what errors you get
Let me remake the code for you. While i’m doing so, I will tell you what you did wrong.
MarketPlaceService instead of MarketplaceService
Make sure you spell everything correctly when scripting! Don’t forget the capitals, and etc…
New Code :
Open Me
-- Variables
local VipDoor = game.Workspace.VIPDoor
local Player = game.Players.LocalPlayer
local GamepassId = 44709053
local PlayerId = Player.UserId
----------------------------------------
-- Code
if game:GetService("MarketPlaceService"):UserOwnsGamePassAsync(PlayerId, GamepassId then
VipDoor.Transparency = 0.8
VipDoor.CanCollide = false
else
VipDoor.Transparency = 0
VipDoor.CanCollide = true
end
Reminder :
→ If this worked, don’t forget to mark this as the solution.