I am trying to make a VIP only door so only people with the VIP gamepass can enter the room. This script is supposed to turn off collision for people who have the gamepass, but it's just not working correctly. Any help?
local GamepassService = game:GetService("MarketplaceService")
local PhysicsService = game:GetService("PhysicsService")
local GamepassDoor = workspace:WaitForChild("VIProom_new"):WaitForChild("vp_BTAI50iN25")
local GamepassId = 6574369
local Group = "Owners"
PhysicsService:CreateCollisionGroup(Group)
PhysicsService:CollisionGroupSetCollidable(Group, Group, false)
PhysicsService:SetPartCollisionGroup(GamepassDoor, Group)
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
if GamepassService:UserOwnsGamePassAsync(Player.UserId, GamepassId) then
for _,v in pairs(Character:GetDescendants()) do
if v:IsA("BasePart") then
PhysicsService:SetPartCollisionGroup(v, Group)
end
end
end
end)
end)

2 comments
why don't you from a localscript do if game.Players.LocalPlayer.Name == "name" then workspace.Part.CanCollide = false end
because they have to own a gamepass to enter the room with the VIP door