Identifying if two parts collide together

Hello, I am trying to identify when these two parts collide and when they do print a message that says “Hello”.

I’ve tried the following script:


for _,Part in ipairs(game.Workspace.BoatA.BoatA:GetDescendants()) do
    if Part:IsA("BasePart") then
        Part.Touched:Connect(function(Hit)
                print("test")  
        end)
    end
end

Both parts are cancollide = true and cantouch = true. I’ve searched the devforum for any other similar posts but none of the information seems to have helped me. It’s like the parts do not identify when theyre touching each other.

Any support is greatly appreciated, thanks!

(Inside BoatA can be seen below)
image

i don’t think your script will work because it will only work when part is touched not after being touched

I don’t know how this is supposed to check when two parts collide, but you should use BasePart:GetTouchingParts with just one touched event