Touched not connecting

if i check a part that was already in game, it does trigger.
any of the new parts it does not

Weird, are the parts spawned by a server script?, if so are you also putting the “Tags” in to the later spawned Parts? nvm u just said it mb

in here you can see the script that adds the tags to the parts

the collectionservice script has an event GetInstanceAddedSignal
this event does trigger when a part gets added to the collection server

inside the Killscript I made a print to see on what parts this function runs

the print inside the kill script does get triggered with the right part
this is a signal for me that – the part has been added to collectionservice(kill)
and that the script is trying to turn it into a killpart

haven’t really use CollectionService yet but i do know that it shoud work like Getchildren loops, anyways GetInstanceAddedSignal Should be detecting the later added parts if i assume it works like ChildAdded

If I’m being honest, I know you wrote your entire framework over the fact that, it should be using the .Touched connection, however… there are plenty of better ways to do this:

A.) Region3’s.
B.) Raycast

If you’re looking for super-accurate hitboxes, check out this module somebody made. :grinning_face_with_smiling_eyes:

the .Touched connection event is very insecure, not 100% reliable, and overall… is just really bad, so I suggest you use one of these alternatives instead. Best of luck!

I think his problem is solely the fact that the part he’s tryna add connection on wouldn’t do so.

Even if he does eventually fix it, .Touched is overall just a really bad implementation for hitboxes. It’s super insecure, inaccurate, I could go on really… but, for the sake of time, just use one of these alternatives. :smiley:

I guess, but i can’t seem to find the issue on his script, it’ll need alotta testing to see/solve the problem.

Yeah, honestly, it’s probably not even worth fixing. Again, once he does fix it, he’ll most likely have event issues regarding whether it connects or not in the future, so honestly he should probably just abandon this and hop on a better solution!

But, that’s just my take. I’m not saying he should, but it’s probably a better alternative altogether to just use a better, more efficient method.

the parts are not moving ,inside a tool or terrain
maybe it is better if i just show what it is for.
https://www.roblox.com/games/6717581217/NEW-Easy-Obby-Acrophobia?refPageId=aa596f34-1720-41e1-95ac-5a34e441a186

the problem could be here it might be returning nil? or have you tested that already?, i see its for an obby game

So, from what I understand, you’re essentially trying to make a kill brick?

Why not instantiate a region3 for each kill brick, have each kill brick non-can collide, and if anything steps into it at any given time, execute the code you’re trying to, (aka kill them?)

Maybe that’d be costly, though… hmmmm… :thinking:

even if it returns nil it should still be a killpart.

the return is only so i can keep track of what part is a killpart.
so i can disconnect it later

Now, what is it that you’re trying to return…?

The instance of which has been touched? Or the connection itself? I’ve been reviewing some of your code, and from what I’m seeing, it kind of looks like you’re trying to return the connection event as a whole. I’m not entirely sure if you’re going to get any expected results by returning just the connection event.

Maybe instead, return the character inside the .Touched connection, then that way, when you return the connection, it’ll maybe return that character as well?

i am returning the connection

Connections[TaggedPart][i] = func(TaggedPart) -- here i store the connection in a table


-- this function disconect the conection in case it is no longer a killpart
CollectionService:GetInstanceRemovedSignal(i):Connect(function(TaggedPart)
		Connections[TaggedPart][i]:disconnect()
		Connections[TaggedPart][i]=nil
	end)

tried this and it worked.?

local CollectionService = game:GetService("CollectionService")
local Connections = {}

local Part = Instance.new("Part") 
Part.Parent = game.Workspace 
CollectionService:AddTag(Part,"Kill")

wait(1)

	local func = require(script.Kill)
	local TaggedParts = CollectionService:GetTagged("Kill")
	
	for _, TaggedPart in pairs(TaggedParts) do
		if Connections[TaggedPart] == nil then
			Connections[TaggedPart] = {}
		end
		Connections[TaggedPart] = func(TaggedPart)
	end

	CollectionService:GetInstanceAddedSignal("Kill"):Connect(function(TaggedPart)
		if Connections[TaggedPart] == nil then
			Connections[TaggedPart] = {}
		end
		Connections[TaggedPart] = func(TaggedPart)
	end)
	CollectionService:GetInstanceRemovedSignal("Kill"):Connect(function(TaggedPart)
		Connections[TaggedPart]:disconnect()
		Connections[TaggedPart]=nil
	end)

local Part = Instance.new("Part") 
Part.Parent = game.Workspace 
CollectionService:AddTag(Part,"Kill")

Maybe you’d have a better, much easier time defining whether it can be active or not by using an external value such as an attribute, or just a boolean instead, so you can re-instantiate it instead of calling to a new connection event, which would just overall take up more memory.

i think i found the issue, it’s the name of the tags. you add “kill” while the wanted name is “Kill”?

Not sure but this worked on my end, i even spawned a part manually on CMD

in top of the collectionservice i do

i=v.Name

if this was the case non of the killparts should have worked

can u share me your script so i can compare it?