engine.touched:connect(function(hit)
if not hit:isa("basepart") then return end
local name = hit.name:lower()
local partline = hit:findfirstchildwhichisa("numbervalue")
if partline and line and partline.value ~= line.value then return end
if name == "stop" and not locked then
locked = true
moving = false
doors(true)
local txt, dest = "", ""
local l = hit:findfirstchild("setline")
if l and l:isa("numbervalue") then txt = tostring(l.value) end
local d = hit:findfirstchild("setdest")
if d and d:isa("stringvalue") then dest = d.value end
signs(txt, dest)
task.wait(14)
doors(false)
task.wait(6)
moving = true
locked = false
elseif name == "left" then
turnby(90)
elseif name == "right" then
turnby(-90)
elseif name == "turn" then
auto()
elseif name == "lane left" then
task.spawn(function()
spin.angularvelocity = vector3.new(0, 0.5, 0)
task.wait(0.3)
spin.angularvelocity = vector3.zero
task.wait(2)
spin.angularvelocity = vector3.new(0, -0.5, 0)
task.wait(0.3)
spin.angularvelocity = vector3.zero
end)
elseif name == "lane right" then
task.spawn(function()
spin.angularvelocity = vector3.new(0, -0.5, 0)
task.wait(0.3)
spin.angularvelocity = vector3.zero
task.wait(2)
spin.angularvelocity = vector3.new(0, 0.5, 0)
task.wait(0.3)
spin.angularvelocity = vector3.zero
end)
elseif name == "speed" then
local s = hit:findfirstchild("speed")
if s and s:isa("numbervalue") then
maxspeed = s.value
end
end
end)