Getting the parent / model of a triggered event [Closed]

ignore the previous errors

Main Objective:
The proximity promt is inside of a part, which that part is inside of a model. I want to get the Model’s name and along side getting the part (Left_Door).

I have tried using promt.parent.parent.name which does get (“Door_2”) but then I cannot obtain the part (“Left_Door”), So any ideas on how I can get the Door Name alongside the Left_Door part.

P.S Please don’t question why I’m using a module script

1 Like

This is actually pretty easy. You can use FindFirstChild() or WaitForChild().

local door = Promt.Parent.Parent.Name
local leftDoor = Promt.Parent.Parent:FindFirstChild("Left_Door")

You misspelled “Prompt” for your variable using “Promt” instead, so I used that in case this was on purpose:

Try this

local door = Promt.Parent.Parent
local leftDoor = door:FindFirstChild("Left_Door" , true)

print(door.Name , leftDoor.Name)
1 Like

I tired that and it didn’t work, It says “Attempted to call a nil value”.

I think I found a work around, quite dumb of me not to realize that I can use another function. :man_facepalming:

1 Like