Hi! I am currently making a door that will make any player in a group go through it, however. I am using PhysicsService:SetCollisionGroupCollidable() but it doesn’t allows me to go through that door even though I’m at that group. I used print statements and it does work, but when I try to set them to false, it keeps being true, my script is:
local PhysicsService = game:GetService("PhysicsService")
local PlayersService = game:GetService("Players")
local workers = "Workers"
local doors = "Doors"
PhysicsService:CreateCollisionGroup(doors)
PhysicsService:CreateCollisionGroup(workers)
PhysicsService:SetPartCollisionGroup(workspace.GroupDoor1, doors)
PhysicsService:SetPartCollisionGroup(workspace.GroupDoor2, doors)
local function getPlayerParts(character, group)
for _, child in ipairs(character:GetChildren()) do
if child:IsA("BasePart") then
PhysicsService:SetPartCollisionGroup(child, group)
end end
character.DescendantAdded:Connect(function(descendant)
if descendant:IsA("BasePart") then
PhysicsService:SetPartCollisionGroup(descendant, group)
end end) end
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
if player:GetRoleInGroup(6160853) ~= "Guest" then
getPlayerParts(character, workers)
end end) end)
PhysicsService:CollisionGroupSetCollidable(doors, workers, false)
if not PhysicsService:CollisionGroupsAreCollidable(doors, workers) then
print("Collision groups weren't set properly.")
PhysicsService:CollisionGroupSetCollidable(doors, workers, false)
else
print("Collision groups are set properly!")
end
I tried removing the if statement that sets the collisions but it doesn’t works.
Edit: For some reason, there is a collision group that appears randomly named “p”, I un-checked it and it did work but not with the others.