A while ago(like last year iirc), I made a script based off of a tutorial I saw from ROBLOX for creating team-only doors using collision groups. However, recently, when I tried to sue the script again, it didn't work, and kept trying to assign me to the "6" or "7" groups, even when I remove the line of code that assigns people who aren't on any of the defined teams to the 6th group(group 7 shouldn't be assigned to anyone at all). Can anyone help me resolve this issue?
print("Test") local PhysicsService = game:GetService("PhysicsService") local enemies = "Navy blue" --Change this to your enemy team's. local defenders = "Bright red" --Change this to your group's team's. PhysicsService:CreateCollisionGroup(1) --This one is for when you want players to not be able to interact with something, but want bullets to be able to fly through. Well, it was. It's broken currently, but the rest of the script needs it in order to serve it's primary function. You could set this to "GetCollisionGroupName("1") if you wanted, and then if you know how, create a collision group 1 in the editor. PhysicsService:CreateCollisionGroup(4) PhysicsService:CreateCollisionGroup(5) PhysicsService:CreateCollisionGroup(7) print("Player groups loaded") local blueDoors = "4" --Hostiles local redDoors = "5" --Defenders local greenDoors = "7" --Civies -- Create door collision groups PhysicsService:CreateCollisionGroup(2) PhysicsService:CreateCollisionGroup(3) PhysicsService:CreateCollisionGroup(6) print("Door groups loaded") local bluePlayers = "2" --Hostiles local redPlayers = "3" --Defenders local greenPlayers = "6" --Civies -- Create player collision groups local function setCollisionGroup(character, groupName) for _, child in ipairs(character:GetChildren()) do if child:IsA("BasePart") then PhysicsService:SetPartCollisionGroup(child, groupName) end end character.DescendantAdded:Connect(function(descendant) if descendant:IsA("BasePart") then PhysicsService:SetPartCollisionGroup(descendant, groupName) end end) end local Players = game:GetService("Players") local function onPlayerAdded(player) local function onCharacterAdded(character) if player.TeamColor == BrickColor.new(defenders)then setCollisionGroup(character, redPlayers) elseif player.TeamColor == BrickColor.new(enemies) then setCollisionGroup(character, bluePlayers) else setCollisionGroup(character, greenPlayers) end end player.CharacterAdded:Connect(onCharacterAdded) end Players.PlayerAdded:Connect(onPlayerAdded) --This bit chagnes up collisions PhysicsService:CollisionGroupSetCollidable(blueDoors, bluePlayers, false) PhysicsService:CollisionGroupSetCollidable(redDoors, redPlayers, false) PhysicsService:CollisionGroupSetCollidable(blueDoors, redPlayers, true) PhysicsService:CollisionGroupSetCollidable(redDoors, bluePlayers, true) PhysicsService:CollisionGroupSetCollidable(greenDoors, greenPlayers, false) PhysicsService:CollisionGroupSetCollidable(greenDoors, bluePlayers, true) PhysicsService:CollisionGroupSetCollidable(greenDoors, redPlayers, true) PhysicsService:CollisionGroupSetCollidable(blueDoors, greenPlayers, true) PhysicsService:CollisionGroupSetCollidable(redDoors, greenPlayers, true)