Why does my CollisionGroup not work on the first person in a server?
This is supposed to be a door for a gamepass (lounge). If a player owns the gamepass, they will be able to go through unless they are the first person to join. They can't walk through the wall.
01 | local gamepassid 1 = 5645201 |
02 | local gamepassid 2 = 5645200 |
06 | local part = script.Parent |
07 | local PhysicsService = game:GetService( "PhysicsService" ) |
08 | local MarketplaceService = game:GetService( "MarketplaceService" ) |
10 | PhysicsService:CreateCollisionGroup( "GamepassHolders" ) |
11 | PhysicsService:CollisionGroupSetCollidable( "GamepassHolders" , "GamepassHolders" , false ) |
13 | PhysicsService:SetPartCollisionGroup(part, "GamepassHolders" ) |
15 | game.Players.PlayerAdded:Connect( function (player) |
16 | local uid = player.UserId |
17 | if MarketplaceService:UserOwnsGamePassAsync(uid, gamepassid 1 ) or MarketplaceService:UserOwnsGamePassAsync(uid, gamepassid 2 ) then |
18 | player.CharacterAdded:Connect( function (character) |
19 | for i, v in pairs (character:GetDescendants()) do |
20 | if v:IsA( "BasePart" ) then |
21 | PhysicsService:SetPartCollisionGroup(v, "GamepassHolders" ) |