The client can set CanCollide = false of parts and pass through them?

Hello
I noticed that in a local script you can set the attribute CanCollide of parts to false and pass through them or even stay inside them, no matter that in the same time on the server the same CanCollide attribute is with value “true”?
Is this normal?

Thanks

Yes, this is normal because the player controls it’s movement, meaning if they set something’s canCollide to false and “move” through a block, the server doesn’t sanity check it. You can easily fix this by introducing some anti-noclip scripts, which cast rays and see if the player is directly in a block.

1 Like

But this means that the client can easily “ignore” all kind of walls and doors and pass through them?
And these anti-noclip scripts must run on the server?
Do you mean that the server must check every second (or even more often) the position of each player in comparison to the previous position of the same player? This would kill the performance…

Yes, clients can ignore all parts, and the security has to run on the server since otherwise it’d be useless. Luckily, raycasts are extremely cheap and won’t kill your performance.

Are there any good publicly available anti-noclip scripts, which you can recommend?

I don’t know any public anti-noclips, sorry.

You could check if the player is in a part, and see if it’s collisions are off or on, and if so, push them back or kick them.

Slight-pseudocode:

while task.wait() do
   if player.character.HumanoidRootPart.CFrame == part.CFrame and part.CanCollide then
       player:Kick()
   end
end

That doesnt really works

CFrame is like a vector, there is only 1 point, plus CFrame also includes rotation.

So the character hmr needs to be at the exact same point and the exact same orientation for it to work