New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

Why am I still colliding with all humanoids in workspace?

Asked by 11 months 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