Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why am I still colliding with all humanoids in workspace?

Asked by 5 years ago

I am setting up a code to where only I will pass through all humanoids in workspace. This means both dummies and players. However when ran, I still collide with them. I've been trying to fix this for 2 days. Any help?

local PhysicsService = game:GetService("PhysicsService")
PhysicsService:CreateCollisionGroup("Yourself")
PhysicsService:CreateCollisionGroup("Humanoids")
PhysicsService:SetPartCollisionGroup(Character:FindFirstChildWhichIsA("BasePart"),"Yourself")
for i,v in pairs(workspace:GetDescendants()) do
    if v:FindFirstChild("HumanoidRootPart") and v.Name ~= Player.Name then
    PhysicsService:SetPartCollisionGroup(v:FindFirstChildWhichIsA("BasePart"),"Humanoids")
    end
end
PhysicsService:CollisionGroupSetCollidable("Yourself","Humanoids",false)

Answer this question