How Do I Make A No-Clip Script?

Hello. I’ve made a custom admin system, which of course, includes a fly command. I want this command to also allow the user to clip through objects. However, every time I try to set the collisions of the HumanoidRootPart/UpperTorso/LowerTorso off, they automatically re-enable themselves. What is the best way to allow the player to clip through objects? Should I just make a CollisionGroup?

1 Like

You could make an if true loop script that sets the player’s collisions off, then detects when the collisions are re-enabled and disables them again. Or you could repeatedly change the humanoid’s state to StrafingNoPhysics, which I’ve heard allows users to noclip. Hope this helps, I don’t know how to script any of these.

1 Like

You are correct, you should make a collision group, you can either do this via the Collision Group Editor, which can be found here:

Or via the Physics Service in a script:

local PhyicsService = game:GetService("PhysicsService")
PhyicsService:CreateCollisionGroup("Admin")

Then all you need to set the admin group to not collide with the Default group:
image

Now all you need to do is set the player to the Admin Collision group when you want them to no clip and back to Default when you want them to return to normal.

local Char = workspace[NAME]:GetChildren()
for index = 1, #Char do
	local Part = Char[index]
	if Part:IsA("BasePart") then
		PhyicsService:SetPartCollisionGroup(Part, "Admin")
	end
end
4 Likes

The game already has multiple collision groups, and I want the admin to be universal. Is there any way to script it to not interact with any collision groups?

Just un-select the ability for the admin group to collide with the others, if you are creating it via a script you can use this:
PhyicsService:CollisionGroupSetCollidable(Group1, Group2, false)

1 Like