Make entity no collide with player

Hey I’m trying to make a simple entity that no collides when a player is job x and collides back when hes anything else. It works at first but the collision never goes back to normal. Also tried with ENT:Touch and ENT:EndTouch but no luck.

function ENT:StartTouch(entity)
  if entity:IsPlayer() then
  local teamname = entity:getDarkRPVar("job")
       if teamname == "Civil Protection" then
    self:SetCollisionGroup( 11 )

make sure you do it with hook.Add
Also, you can use team numbers or ply:isCP() instead of team names.

Is there anyway I could do it using the ENT:Touch hooks? The should collide one seems a bit confusing to use

I dont think so. Imagine two players touching at the same time to your entity. It would be such a pain.

So i’d have to use the setcustomcollisioncheck to the morphine entity which im trying to get to nocollide with the player, and also reference that and the player in the hook correct?

What’s confusing about it? Just check if ent1 is the entity you don’t want to collide and check if ent2 is a player then return false.

it is what txike says. I couldn’t really understand what do you mean with reference thing. Just do what txike says.
and yes, you would have to use setcustomcollisioncheck(true) to the morphine entity and check situations in ShouldCollide hook.

Ok I got it, thanks.