Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I detect if a model goes through a brick?

Asked by 9 years ago

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

Log in to vote
0
Answered by
BlackJPI 2658 Snack Break Moderation Voter Community Moderator
9 years ago

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)
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 AeronauticalCharlie 0 — 9y
Ad

Answer this question