I tried reading the wiki for collision filtering, but I still couldn't figure it out. I actually have a script already I got from the wiki that allows no player collisions, so is there an easy way to change it so players also don't collide with parts named "Handle" along with players (which is already in the script)?
local PhysicsService = game:GetService('PhysicsService') PhysicsService:CreateCollisionGroup('Players') PhysicsService:CollisionGroupSetCollidable('Players', 'Players', false) local function disableCollision(obj) if obj:IsA('BasePart') then PhysicsService:SetPartCollisionGroup(obj, 'Players') end end local function setup(model) for i, obj in pairs(model:GetDescendants()) do disableCollision(obj) end model.DescendantAdded:connect(function(obj) disableCollision(obj) end) end game:GetService('Players').PlayerAdded:connect(function(player) if player.Character then setup(player.Character) end player.CharacterAdded:connect(function(char) setup(char) end) end)
local PhysicsService = game:GetService('PhysicsService') PhysicsService:CreateCollisionGroup('Players') PhysicsService:CollisionGroupSetCollidable('Players', 'Players', false) local function disableCollision(obj) if obj:IsA('BasePart') then PhysicsService:SetPartCollisionGroup(obj, 'Players') end end local function setup(model) for i, obj in pairs(model:GetDescendants()) do disableCollision(obj) end model.DescendantAdded:connect(function(obj) disableCollision(obj) end) end game:GetService('Players').PlayerAdded:connect(function(player) if player.Character then setup(player.Character) end player.CharacterAdded:connect(function(char) setup(char) end) end) for i,v in next, game:GetDescendants() do pcall(function() if v:IsA("BasePart") and v.Name == "Handle" then disableCollision(v) end end) end
This script above should handle most cases, you see all you need to do is loop through instances and use a if statement to check if its a part and its name is "Handle" you then disable said collision.
for i,v in next, game:GetDescendants() do pcall(function() if v:IsA("BasePart") and v.Name == "Handle" then disableCollision(v) end end) end
In case the part was in multiple services I looped through the entire game, I used the pcall because some instances error if you try to do certain things on it, like checking the classname, but it might not be necessary as I could be wrong. Note that this will not cover cloning the handle parts or their ancestors, if its necessary to do so then you must manually do it or use the .DescendantAdded event.