I have tried
if hit.Parent ~= child --[[i have defined this value]] then --code end
Do it something like this:
Part.Touched:Connect(function(hit) if Part.Parent == hit.Parent then -- We are saying that if the part's parent is equal to the parent of the item that hitted the part. end end)
If you have any questions, I will definitely help.
There are multiple ways to do this.
1:
if hit.Parent == Part.Parent then -- code here
2:
if hit.Parent:FindFirstChild("Part") then -- code here