Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I check if 2 parts parents are the same?

I have tried

if hit.Parent ~= child --[[i have defined this value]] then
	--code
end

2 comments

0

Please explain you question properly.

0

for example a part touches a part. how do i check if the 2 parts parents are the same?

2 answers

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.

1 comment

0

If that doesn't work try 'if Part.Parent == hit.Parent.Parent then'

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

This discussion is preserved as it was. New answers, comments, and votes are closed.