Help on making an effecient noclip script

Hey everyone, I’m in need of help with creating a noclip script for my game.
Even though it might seem like it, i intend no harm with this script, it is for my game.

What is this gonna be used for?
In my game, there will be special abilities for each character that the player can choose, intangibility is one of them. So i’m in need of a noclip system.

What needs to happen?
The player’s character needs to be able to go trough walls and floors, while still being able to move with BodyVelocity, BodyPosition, etc.

What have i tried?

--First
game:GetService("RunService").RenderStepped:Connect(function()
 Humanoid:ChangeState(11)
 wait()
end)
--

--Second
for i,v in ipairs(workspace:GetDescendants()) do
 if v:IsA("BasePart") and v.CanCollide == true and v.Anchored == true then
  v.CanCollide = false
 end
end
--

The first method caused issues because the player wasn’t able to move using BodyPosition.

The second method caused issues because the various NPC’s and some objects in the map would just fall through the floor.

Both of these methods were excecuted in a LocalScript.


Any help is appreciated, if you have any further questions, feel free to ask!

You can use CollisionGroups, loop through the player’s baseparts and set each parts collision group. Using a for loop.

In regards to your second method, instead of getting everything in workspace you can maybe create folders for each group of objects, and loop through them. I’m not sure about your first method though, Its seems valid.

I will look into it and try it out, thank you!