I have a problem with the Touched event ignoring Anchored parts, I'm making a barrier which moves things to the outer walls. For now, it just teleports parts to 0,0,0 as it's an easy way to test it.
barrier = script.Parent
function onTouch(hit)
local h = hit.Parent
if h == nil then return end
if h == workspace then
hit.CFrame = CFrame.new(0,0,0)
else
local part = h:findFirstChildOfClass("Part")
if part ~= nil then
part.CFrame = CFrame.new(0,0,0)
end
end
end
barrier.Touched:connect(onTouch)
It works on any part unless it is anchored, and that's where the issue is. Because the Touched event doesn't work on anchored parts, it allows anything that uses anchored parts to kill to just bypass it.
For example, Scroll of Sevenless (a Roblox gear) creates several parts which explode, and those parts are anchored so they end up not getting repositioned.
I was wondering if I could use Region3 and set its boundaries to be equal to the barrier part's dimensions and then reposition anything within those boundaries? - If that won't work, please tell me any solutions you know of.

6 comments
Thank you very much, I'm going to give GetTouchingParts() a try because raytracing is probably too complicated for me, and sounds laggier.
Alright, if it worked, please accept the answer posted! Really helps me out with something.
Yes, it worked! Thank you so much.
Np!
Hey. Is there any way to opt an individual part out of this process without breaking it? Because if it touches the Baseplate or its child part which is meant to give it an outline it teleports those too.
Ya, simply do an if v.Name ~= "Baseplate" then in it, it should exclude anything by the name of baseplate, this can be done repeatedly as a sort of filter.