How would I exclude a group from the touched event?

script:

local touched = script.Parent.Parent.PrimaryPart.Touched:Connect(function() end) touched:Disconnect()

I need to exclude a group how would I do that?

Is that all of your script? If not, give us the full script.

all it then does is check if it was hit but I need to exclude a group

		if touched then
			script.Parent.Parent.PrimaryPart.Anchored = true
		else
			script.Parent.Parent.PrimaryPart.Anchored = false
		end

Try this:

local part = --wherever the trigger is for the touched event

part.Touched:Connect(function(args)
    local args = --the group you want to exclude
    if args then
        return end
    else
        --code
    end
end)

No it checks if anything is touching it at one time I don’t need to see if its touching when I do not need to see if it is touching script

db = false
game.ReplicatedStorage.Start.OnServerEvent:Connect(function(player, camPos)
	print("hi")
	local throwOffset = 10 --studs in front of head for part to spawn
	local head = player.Character.Head
	local newPos = head.Position + camPos*throwOffset

	script.Parent.Parent.PrimaryPart.CFrame = CFrame.new(newPos,newPos+camPos)
end)
local touched = script.Parent.Parent.PrimaryPart.Touched:Connect(function() end) touched:Disconnect()
script.Parent.ProximityPrompt.Triggered:Connect(function(player)
	if db == false then
		db = true
		game.ReplicatedStorage.Grab:FireClient(player)
		script.Parent.Parent.PrimaryPart.Anchored = true
	else
		db = false
		game.ReplicatedStorage.Drop:FireClient(player)
		wait(0.5)
		if touched then
			script.Parent.Parent.PrimaryPart.Anchored = true
		else
			script.Parent.Parent.PrimaryPart.Anchored = false
		end
	end
end)

I’m sorry but I am very confused by this grammar

Just use overlap params and then you can blacklist instances

Do you want the code to run when the part is not in a certain group?

Don’t know what you cant understand from my script and this line. It has to fire only when I trigger the proximity prompt

video:

Sorry i’m a bit confused. Do you want to set up a touched event when the proximity prompt is triggered? Can you please give some more context?

NO how have you come to this all I need is a way to exclude a group from a touched local event
I do not need a new script or a different way to do it I am just asking a question on how I exclude a model from the script below

Something like this?

local BackList = {} -- array of backlisted models here
local Connection
Connection = script.Parent.Parent.PrimaryPart.Touched:Connect(function(Part)
    for i, BacklistedModel in ipairs(BackList) do
        if Part:IsDescendantOf(BacklistedModel) then return end
    end
end)

don’t understand how to use it, I can read code but can’t read people describing code as the developer page gives no examples and does not tall me what it does.

Another method is just by disabling a property called “CanTouch”

That doesn’t work either (fdhsfgjdsh)

OverlapParams are used to filter results from functions like GetPartBoundsInBox.

Have you also disabled, “CanQuery”?

how would I create a blacklist though?

Did you try this?

I have a question, is it possible to look through a table and see if 1 value is not the descendant of the model?