Disabling player collisions on the client

So in short, I’m trying to make some invisibility thing that can make you go through players. Though I’m not quite sure how I can disable player collisions on the client. I’ve already tried looping through Players, setting their CanCollide property to false on a LocalScript, though it was no use.

i would look into CollisionGroups using PhysicsService for something such as this, these reference pages below provide code examples.

https://developer.roblox.com/en-us/articles/Player-Player-Collisions

https://developer.roblox.com/en-us/articles/Collision-Filtering

1 Like

I’m not sure that’s what you’re looking for, but here’s how to disable player collisions:

script.Parent = game:GetService(“ServerScriptService”)
local PhysService = game:GetService(“PhysicsService”)
local PlayerGroup = PhysService:CreateCollisionGroup(“p”)
PhysService:CollisionGroupSetCollidable(“p”,“p”,false)

function NoCollide(model)
for k,v in pairs (model:GetChildren()) do
if v:IsA"BasePart" then
PhysService:SetPartCollisionGroup(v,“p”)

end
end
end

game:GetService(“Players”).PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(char)
char:WaitForChild(“HumanoidRootPart”)
char:WaitForChild(“Head”)
char:WaitForChild(“Humanoid”)
wait(0.1)
NoCollide(char)

if player.Character then
NoCollide(player.Character)
end
end)
end)

5 Likes