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 detect if a model goes through a brick?

I am building PAPI lights on ROBLOX, and I need to detect that a plane has gone through a brick, so that light's turn white or red.

How do I detect the plane (model) going through a brick so that it trigger's lights.

If you do not understand, just ask and I'll be happy to explain it better.

1 answer

You can check if a part is a descendant of a model with a neat little method called IsDescendantOf. So when a part touched the trigger, you can check to see if the part is a descendant of the model and run your function.

local model = game.Workspace.Model
local triggerPart = script.Parent

triggerPart.Touched:connect(function(otherPart)
	if otherPart:IsDescendantOf(model) then
		print(otherPart.Name .. " triggered a touch event!")
		--code
	end
end)

1 comment

0

Seem's to not be working. I want to detect if my plane is going through a brick. See here http://prntscr.com/4zx3r7

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