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

How to find a part when a part is connected?

Asked by 5 years ago

is there a way to have a moving part look for a part and get a value from that part. so like an elevator you have x floors first floor it has a detector with a value of 1 for first floor then seconded floor with a detector value of 2. I don't want to define all the detectors in the game I want it when the elevator stops it searches for a part name detector then it finds the value and gets the value to say its on floor 2.

0
I Think you may just have to define all variables. promaster11111 -8 — 5y
0
ok thanks overkillerz1990 3 — 5y
0
can i do if part.Touched:connect(FirstFloor, SeconedFloor) then overkillerz1990 3 — 5y
0
No. connect is deprecated, it's Connect. Also, the Touched event passes only the part that touched it, nothing else. User#19524 175 — 5y
View all comments (2 more)
0
And seeing what you want to do, it will error, since you're trying to listen for an event within an if statement. User#19524 175 — 5y
0
What would be the best way to change the elevators value when it connects to a part with a value overkillerz1990 3 — 5y

Answer this question