How would I go about making a part collide with players?

I’m trying to make a part not collide with a player and their camera, but collide with everything else in workspace. How would I do that?

1 Like

But I still want it to collide with other objects, just not the player and it’s camera.

Ohh, oops. Probably refer to Collisions | Documentation - Roblox Creator Hub because I’m pretty inexperienced myself. Sorry for the misunderstanding

Yeah that’s what I don’t understand how to use. Can somebody help me on it?

In Liftoff I use CollisionGroups for this. Here’s the exact code. This is run whenever a rocket is spawned.

for i,v in pairs(rock:GetDescendants()) do --rock is the rocket model
	if v:IsA("BasePart") then
		ps:SetPartCollisionGroup(v, "rockets") --ps is PhysicsService
	end
end

If I’m not mistaken this should automatically make players not able to collide with it, but in Liftoff I put players into a “players” CollisionGroup, but again I’m not sure whether or not this is necessary.

I think the camera can still also collide with these parts. If you really need to you can look into forking the camera script, I’m sure there have been discussions here about how to make certain parts not collide with the camera.

You could check if there is a Humanoid inside it by doing

Hit.Parent:FindFirstChild(“Humanoid”)

Follow this but only use one of the collision groups for teams instead of 2. Collisions | Documentation - Roblox Creator Hub

This shows you exactly how to do what you’re trying to do.