How do I script a switch that recognizes a variable? To understand the whole thing I explain you what I want to achieve with this script.
Explanation: If a line has the variable 2313 and drives over the switch, a sensor should recognize the variable and depending upon that this train must drive straight out or to the left/right. but there should be another train over these switches, so with another variable for example 1231. (no automatic train)
It would be really helpful if you want to help me, I have a script but it only works with clickdetector. That's not what I want to achieve with it.
Thanks for reading

4 comments
basically, you can achieve this by using region3 or a ontouch event
but i don't know how to script it, i can already script but i'm still too bad for that
using on touch is easier, try doing that, look here: https://developer.roblox.com/en-us/api-reference/event/BasePart/Touched
thanks for the help but how do I do that with the variables?