Crossing Light Trigger is a Roblox script that activates a crossing light when a part named train touches it. It detects contact with parts inside CrossingLight instances in Workspace and sets the matching light’s on BoolValue to true.
- In Roblox Studio, add a server
ScripttoServerScriptService. - Copy the contents of
CrossingLightController.server.luainto the Script. - Add a
BasePartnamedtraindirectly underWorkspace. - Add each crossing light under
Workspaceas an instance namedCrossingLight. Put its light parts and aBoolValuenamedoninside it.
Start the game with the server Script enabled. When train touches a part inside a CrossingLight, that light’s on value is set to true. The script enables CanTouch on the train and crossing-light parts, so they can register touch events even when CanCollide is false. The value is not reset by this script.
More Roblox script projects by EnderDevelopment: https://github.com/EnderDevelopment