SpeedSensor (1-Way)
Overview
Features
Script Reference
local SpeedLimit = 100 -- Maximum allowed speed shown on the speedometer (in SPS).
local TargetSpeed = 100 -- Target speed the train aims for when ATO is active (in SPS).
local DebounceTime = 15 -- Delay time to prevent repeated actions (in seconds)
local TransparentInGame = false -- Whether to set the sensor to transparent or not in-game.
-- DO NOT EDIT UNLESS YOU KNOW WHAT YOU ARE DOING
script.Parent.DirectionGuide:Destroy()
local Debounce = false
if TransparentInGame == true then
script.Parent.Transparency = 1
end
script.Parent.Touched:Connect(function(child)
if child.Name == "TrainTouchSensor" and Debounce == false then
Debounce = true
child.Parent.Parent.Parent.API.Propulsion.SpeedLimit.Value = SpeedLimit
child.Parent.Parent.Parent.API.Propulsion.TargetSpeed.Value = TargetSpeed
task.wait(DebounceTime)
Debounce = false
end
end)Configuration
Variable
Type
Description
How It Works
Usage Guide
Example
Best Practices
Last updated