Advertisement
ImFirstPlace

Untitled

Oct 18th, 2019
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 37.01 KB | None | 0 0
  1. print("Teknikk Gen5 V2 Elevator Controller Starting...")
  2. print("Script Version V3.1")
  3.  
  4. BtnULit = "http://www.roblox.com/asset/?id=156949987"
  5. BtnLit = "http://www.roblox.com/asset/?id=156949992"
  6.  
  7. IndDirUp = "http://www.roblox.com/asset/?id=66704336"
  8. IndDirDown = "http://www.roblox.com/asset/?id=66704345"
  9. IndDirULit = "http://www.roblox.com/asset/?id=66704228"
  10.  
  11. DirIndLit = "http://www.roblox.com/asset/?id=130007738"
  12. DirIndULit = "http://www.roblox.com/asset/?id=130007740"
  13.  
  14.  
  15. Stop = false
  16.  
  17. Debug = false -- ENABLE DEBUG MODE
  18. PreDoor = false
  19. DoorTimer = 7 -- Set's how long doors should be open
  20. NudgeTimer = 30 -- Set's how long until doors have to force close if held too long
  21. ChimeAfterDoor = true -- Ring the Door Chime after door has opened
  22. ChimeBeforeDoor = false-- Ring the Door Chime before door has opened
  23. FloorPassChime = true -- Beep on floor pass
  24. DoorSensors = true -- Door sensors, reopens if touched
  25. DoorSensorHold = true
  26.  
  27. IgnoreSensor = false
  28. CardLock = false -- Enable floor locking, DOES NOT WORK IN MIC10 MODE
  29. LockedFloors = {} -- Floors that is locked
  30. CardNumber = {} -- Keys that are authorized, Example [301]=3 would Only unlock 3, while [101]=0 Will unlock all floors
  31. -- Motor Speed and Level Offset
  32. SmoothLevel = true -- Try the new leveling method :D
  33. MotorSpeed = 100
  34. MotorStartSpeed = 0.05
  35. MotorStopSpeed = 0.05
  36. StopOffset = 0.5
  37. SmoothOffset = 1
  38. LevelOffset = 5
  39. IndicatorOffset = 5
  40.  
  41. DoorState = "Closed"
  42. DoorStateRear = "Closed"
  43. DoorSpeed = 0
  44. -- Open
  45. DoorL = 47 -- Length of door to CFrame
  46. DoorC = 0.05
  47. -- Close
  48. DoorCL = 47
  49. DoorCC = 0.05 -- How much per CFrame
  50. --
  51. DoorP = 0
  52. DoorPR = 0
  53. DoorOpenTime = 0
  54. DoorHold = false
  55. SlowClose = false
  56. DoorNudge = false
  57. ResetDoorTimer = false
  58. ConfigMode = false
  59. FireLock = false
  60. Alarm = false
  61. Moving = false
  62. Busy = false
  63. Locked = false
  64. Fire = false
  65. DoorTimerReset = false
  66. MoveDirection = "Up"
  67. UnlockedFloor = 9001
  68. TargetFloor = 0
  69. TotalFloors = 0
  70. CallQuene = {}
  71. DCalls = {}
  72.  
  73. MoveTimeout = 15
  74. MoveTime = 0
  75. MoveFloor = 1
  76. MoveErrors = 0
  77. MoveDB = false
  78. Floor = script.Parent.Floor
  79. Motor = script.Parent.Motor
  80. Car = script.Parent.Car
  81.  
  82. BP = Car.Platform.BodyPosition
  83. BV = Car.Platform.BodyVelocity
  84. TCar = script.Parent.Car
  85. TFloors = script.Parent.Floors
  86. TFloorsG = script.Parent.Floors:GetChildren()
  87. TCarG = script.Parent.Car:GetChildren()
  88. SFloor = Floor.Value
  89.  
  90.  
  91.  
  92. BP.position = Car.Platform.Position
  93.  
  94. BP.P = 10000
  95. BP.D = 1000
  96.  
  97. script.Parent.CardReader.Changed:connect(function()
  98. if script.Parent.CardReader.Value == true then
  99. UnlockedFloor = 0
  100. else
  101. UnlockedFloor = 9001
  102. end
  103. end)
  104. -- NEW WELD SCRIPT --
  105. function DoWeld(a, b)
  106. local w = Instance.new("ManualWeld")
  107. w.Part0 = a
  108. w.Part1 = b
  109. w.C0 = CFrame.new()
  110. w.C1 = b.CFrame:inverse() * a.CFrame
  111. b.Anchored = false
  112. print(b.Name)
  113. return w;
  114. end
  115.  
  116.  
  117.  
  118. function DecodeData(String)
  119. local Data = String
  120. local Values = {}
  121. while Data:find("#") do
  122. local TempData,_ = Data:find("#")
  123. table.insert(Values,Data:sub(1,TempData-1))
  124. Data = Data:sub(TempData+1)
  125. end
  126. table.insert(Values,Data)
  127. return Values
  128. end
  129.  
  130.  
  131. -- DESTINATION DISPATCH --
  132.  
  133. script.Parent.Motor.Changed:connect(function()
  134. if not MoveDB then
  135. MoveDB = true
  136. repeat
  137. wait(1)
  138. if Floor.Value ~= MoveFloor then
  139. MoveFloor = Floor.Value
  140. MoveTime = 0
  141. else
  142. MoveTime = MoveTime + 1
  143. end
  144. print("Error Checker: "..MoveTime)
  145. until not Moving or MoveTime == MoveTimeout or Stop == true
  146. if Stop == true then MoveDB = false return end
  147. if MoveTime ~= MoveTimeout then MoveTime = 0 MoveDB = false print("Succeeded to arrive at floor!") end
  148. if MoveErrors == 3 then
  149. coroutine.resume(coroutine.create(function() Stop(Floor.Value, true) end))
  150. script.Parent["Floor Indicator OUTSIDE"].Disabled = true
  151. script.Parent["Floor Indicator"].Disabled = true
  152. TCar.Screen.SurfaceGui.Frame.Indicator.Text = "X"
  153. script.Parent.Floors.Floor1.FloorIndicator.SurfaceGui.Frame.Indicator.Text = "X"
  154. script.Parent.Disabled.Value = true
  155. TCar.BTDIS.Texture.Texture = BtnLit
  156. MoveTime = 0
  157. MoveDB = false
  158. return
  159. end
  160. if MoveTime == MoveTimeout then
  161. MoveErrors = MoveErrors + 1
  162. MoveTime = 0
  163. MoveDB = false
  164. coroutine.resume(coroutine.create(function() Stop(Floor.Value, true) end))
  165. end
  166. end
  167.  
  168. end)
  169.  
  170. script.Parent.DestCall.Changed:connect(function()
  171. if script.Parent.DestCall.Value ~= "READY" then
  172. local CallData = DecodeData(script.Parent.DestCall.Value)
  173. table.insert(DCalls,CallData[1])
  174. Quene(tonumber(CallData[1]),"Add","Call")
  175. if not Moving and Floor.Value == tonumber(CallData[1]) then
  176. Quene(tonumber(CallData[2]),"Add","Call") -- let's call this after Quene
  177. end
  178. end
  179. script.Parent.DestCall.Value = "READY"
  180. end)
  181.  
  182.  
  183.  
  184. function ProcessCall(xFloor, xDest)
  185. if xDest > xFloor then
  186. ElevatorRun("U")
  187. end
  188. if xDest < xFloor then
  189. ElevatorRun("D")
  190. end
  191. end
  192.  
  193.  
  194.  
  195.  
  196.  
  197. -- NEW SYSTEM ... ---
  198.  
  199.  
  200. ERRun = false
  201. ERStop = false
  202. ERFloor = Floor.Value
  203. function ElevatorRun(Direction)
  204. if not ERRun then
  205. ERRun = true
  206. repeat wait() until DoorState == "Closed"
  207. Moving = true
  208. BP.P = 0
  209. BP.D = 0
  210. BV.P = 10000
  211. if Debug then print("Doors closed, start moving :)") end
  212. if Direction == "U" then
  213. script.Parent.Direction.Value = "U"
  214. MoveDirection = "Up"
  215. CallDirection = "Up"
  216. Motor.Value = 0.000001
  217. wait(0.8)
  218. for i = 0, MotorSpeed, 1 do
  219. Motor.Value = i
  220. wait(MotorStartSpeed)
  221. end
  222. end
  223. if Direction == "D" then
  224. script.Parent.Direction.Value = "D"
  225. MoveDirection = "Down"
  226. CallDirection = "Down"
  227. wait(0.8)
  228. for i = 0, MotorSpeed, 1 do
  229. Motor.Value = -i
  230. wait(MotorStartSpeed)
  231. end
  232. end
  233. local StopElevator = false
  234. while StopElevator == false and Stop == false do
  235. for i = 1, #TFloorsG do
  236. local CF = tonumber(TFloorsG[i].Name:sub(6,7))
  237. if math.abs(TFloorsG[i].Level.Position.Y - Car.Platform.Position.Y) < IndicatorOffset then
  238. if Floor.Value ~= CF then
  239. Floor.Value = CF
  240. end
  241. end
  242. if math.abs(TFloorsG[i].Level.Position.Y - Car.Platform.Position.Y) < LevelOffset then
  243. if ERFloor ~= CF then
  244. ERFloor = CF
  245. if Floor.Value == 1 or Floor.Value == TotalFloors then StopFloor = CF StopElevator = true end
  246. for i,l in pairs(CallQuene) do if CF == l then StopFloor = CF StopElevator = true end end
  247. end
  248. end
  249. end
  250. wait()
  251. end
  252.  
  253. -- STOP --
  254. script.Parent.Direction.Value = "N"
  255. Moving = false
  256. if Stop == true then
  257. if MoveDirection == "Up" then
  258. Floor.Value = Floor.Value + 0.5
  259. end
  260. if MoveDirection == "Down" then
  261. Floor.Value = Floor.Value - 0.5
  262. end
  263. BV.velocity = Vector3.new(0,0,0)
  264. end
  265. if not Stop == true then
  266. Btn(StopFloor,0)
  267. for i,l in pairs(DCalls) do
  268. if StopFloor == l[1] then
  269. Quene(tonumber(l[2]),"Add","Call")
  270. end
  271. if StopFloor == l[2] then
  272. print("Removed "..l[1].." , "..l[2].." call from DestCall")
  273. table.remove(DCalls,i)
  274. end
  275. end
  276.  
  277. for i, l in pairs(CallQuene) do
  278. if l == StopFloor then
  279. print("Removed: "..l)
  280. table.remove(CallQuene,i)
  281. end
  282. end
  283.  
  284.  
  285. coroutine.resume(coroutine.create(function()
  286. for i=1, 0.1, -0.05 do
  287. Car.Platform.Motor.Pitch = i
  288. wait(0.1)
  289. end
  290. end))
  291.  
  292.  
  293. BP.position = Vector3.new(Car.Platform.BodyPosition.position.X,TFloors["Floor"..StopFloor].Level.Position.Y,Car.Platform.BodyPosition.position.Z)
  294. if not SmoothLevel then
  295. BP.P = 10000
  296. BP.D = 1000
  297. BV.P = 0
  298. BV.velocity = Vector3.new(0,0,0)
  299. end
  300.  
  301.  
  302. local Dir = MoveDirection
  303. Quene(StopFloor,"Remove")
  304. if Floor.Value == TotalFloors then
  305. MoveDirection = "Down"
  306. end
  307. if Floor.Value == 1 then
  308. MoveDirection = "Up"
  309. end
  310. if ChimeBeforeDoor then coroutine.resume(coroutine.create(function() DoChime() end)) end
  311.  
  312. if SmoothLevel then
  313. for i=MotorSpeed, 0.5, -4 do
  314. if Dir == "Up" then
  315. BV.velocity = Vector3.new(0,i,0)
  316. elseif Dir == "Down" then
  317. BV.velocity = Vector3.new(0,-i,0)
  318. end
  319. wait()
  320. end
  321.  
  322. repeat
  323. wait()
  324. until math.abs(TFloors["Floor"..StopFloor].Level.Position.Y - Car.Platform.Position.Y) < SmoothOffset
  325. BP.P = 8000
  326. BP.D = 2500
  327. BV.P = 0
  328. BV.velocity = Vector3.new(0,0,0)
  329. end
  330.  
  331. if PreDoor then
  332. coroutine.resume(coroutine.create(function() DoorRun(1) end))
  333. end
  334.  
  335.  
  336. repeat
  337. wait()
  338. until math.abs(TFloors["Floor"..StopFloor].Level.Position.Y - Car.Platform.Position.Y) < StopOffset
  339. Car.Platform.Motor:Stop()
  340. wait(0.5)
  341. Motor.Value = 0
  342.  
  343. TargetFloor = 0
  344. script.Parent.TargetFloor.Value = 0
  345.  
  346.  
  347. if not PreDoor then
  348. coroutine.resume(coroutine.create(function() DoorRun(1) end))
  349. end
  350. end
  351. Busy = false
  352. ERRun = false
  353. if Stop == false then
  354. print("Waiting 5 seconds until checking for calls")
  355. wait(5)
  356. Quene(0,"Check")
  357. end
  358. -- END STOP --
  359.  
  360.  
  361.  
  362. end
  363. end
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372. function DoorRun(xm)
  373. if Debug then print("DoorRun("..xm..") executed") end
  374. if xm == 1 then
  375. coroutine.resume(coroutine.create(function() DoorOpen(Floor.Value,false) end))
  376. -- coroutine.resume(coroutine.create(function() RearDoorOpen(Floor.Value,false) end)) -- REAR DOOR
  377. end
  378. if xm == 2 then
  379. coroutine.resume(coroutine.create(function() DoorClose(Floor.Value) end))-- MAIN DOOR
  380. -- coroutine.resume(coroutine.create(function() RearDoorClose(Floor.Value) end)) -- REAR DOOR
  381. end
  382. if xm == 3 then
  383. if DoorState == "Closing" then
  384. coroutine.resume(coroutine.create(function() DoorReOpen(Floor.Value,true) end))-- MAIN DOOR
  385. -- coroutine.resume(coroutine.create(function() RearDoorOpen(Floor.Value,true) end))-- MAIN DOOR
  386. end
  387. end
  388. end
  389.  
  390. function DoorOpen(F,ReOpen)
  391. if F ~= Floor.Value and Moving == true then return end -- IF NOT OF FLOOR DO NOT Open
  392. if DoorNudge == true then return end -- NO OPEN ON NUDGE
  393. if DoorState == "Closed" then -- open when closed and reopen if closing
  394. DoorState = "Opening"
  395. local DOFL = TFloors:FindFirstChild("Floor"..F):FindFirstChild("DoorLeft"):GetChildren()
  396. local DOFR = TFloors:FindFirstChild("Floor"..F):FindFirstChild("DoorRight"):GetChildren()
  397. wait(0.1)
  398. DoChime()
  399. wait(0.8)
  400. for i=DoorP, DoorL do
  401. if DoorState == "CancelReopen" then DoorState = "OkReopen" print("Grr, need to reopen...") return end
  402. DoorP = DoorP + 1
  403. for R=1, #DOFR do
  404. DOFR[R].CFrame = DOFR[R].CFrame * CFrame.new(DoorC, 0, 0)
  405. end
  406. for L=1, #DOFL do
  407. DOFL[L].CFrame = DOFL[L].CFrame * CFrame.new(-DoorC, 0, 0)
  408. end
  409. for i,l in pairs(Car.Level.DoorRight:GetChildren()) do
  410. l.C1 = l.C1 * CFrame.new(-DoorCC, 0, 0)
  411. end
  412. for i,l in pairs(Car.Level.DoorLeft:GetChildren()) do
  413. l.C1 = l.C1 * CFrame.new(DoorCC, 0, 0)
  414. end
  415. wait(DoorSpeed)
  416. end
  417.  
  418. if DoorState == "CancelReopen" then DoorState = "OkReopen" return end
  419. DoorState = "Open"
  420. SetCarDirInd(1)
  421. SetFloorDirInd(1)
  422. if ChimeBeforeDoor then coroutine.resume(coroutine.create(function() DoChime() end)) end
  423.  
  424. -- CREATE DOOR TIMER
  425. coroutine.resume(coroutine.create(function()
  426. local CTime = 0
  427. repeat
  428. wait(1)
  429. CTime = CTime + 1
  430. if DoorTimerReset == true then
  431. print("Timer reset due to sensor touched or Open clicked")
  432. CTime = 0
  433. DoorTimerReset = false
  434. end
  435. until CTime > DoorTimer or DoorState ~= "Open"
  436. if CTime > DoorTimer then
  437. DoorRun(2)
  438. elseif DoorState ~= "Open" then
  439. print("Door was closed before timer ended :)")
  440. end
  441. end))
  442. DoorCheck() -- NUDGE TIMER
  443.  
  444. end
  445. end
  446.  
  447. function DoorReOpen(F)
  448. if F ~= Floor.Value and Moving == true then return end -- IF NOT OF FLOOR DO NOT Open
  449. if DoorNudge == true then return end -- NO OPEN ON NUDGE
  450. if DoorState == "Closing" and DoorNudge == false then -- open when closed and reopen if closing
  451. DoorState = "CancelReopen"
  452. repeat wait() until DoorState == "OkReopen"
  453. wait(0.2)
  454. DoorState = "Opening"
  455. local DOFL = TFloors:FindFirstChild("Floor"..F):FindFirstChild("DoorLeft"):GetChildren()
  456. local DOFR = TFloors:FindFirstChild("Floor"..F):FindFirstChild("DoorRight"):GetChildren()
  457. wait(0.1)
  458. DoChime()
  459. wait(0.8)
  460. for i=DoorP, DoorL do
  461. if DoorState == "CancelReopen" then DoorState = "OkReopen" print("Grr, need to reopen...") return end
  462. DoorP = DoorP + 1
  463. for R=1, #DOFR do
  464. DOFR[R].CFrame = DOFR[R].CFrame * CFrame.new(DoorC, 0, 0)
  465. end
  466. for L=1, #DOFL do
  467. DOFL[L].CFrame = DOFL[L].CFrame * CFrame.new(-DoorC, 0, 0)
  468. end
  469. for i,l in pairs(Car.Level.DoorRight:GetChildren()) do
  470. l.C1 = l.C1 * CFrame.new(-DoorCC, 0, 0)
  471. end
  472. for i,l in pairs(Car.Level.DoorLeft:GetChildren()) do
  473. l.C1 = l.C1 * CFrame.new(DoorCC, 0, 0)
  474. end
  475. wait(DoorSpeed)
  476. end
  477.  
  478. if DoorState == "CancelReopen" then DoorState = "OkReopen" print("Grr, need to reopen...") return end
  479. DoorState = "Open"
  480. SetCarDirInd(1)
  481. SetFloorDirInd(1)
  482. --if ChimeAfterDoor then coroutine.resume(coroutine.create(function() DoChime() end)) end
  483.  
  484. -- CREATE DOOR TIMER
  485. coroutine.resume(coroutine.create(function()
  486. local CTime = 0
  487. repeat
  488. wait(1)
  489. CTime = CTime + 1
  490. if DoorTimerReset == true or DoorHold == true then
  491. print("Timer reset due to sensor touched or Open clicked")
  492. CTime = 0
  493. DoorTimerReset = false
  494. end
  495. until CTime > DoorTimer or DoorState ~= "Open"
  496. if CTime > DoorTimer then
  497. DoorRun(2)
  498. elseif DoorState ~= "Open" then
  499. print("Door was closed before timer ended :)")
  500. end
  501. end))
  502. DoorCheck() -- NUDGE TIMER
  503.  
  504. end
  505. end
  506.  
  507. function DoorClose(F,Nudge)
  508. if DoorHold == true then return end
  509. if F ~= Floor.Value and Moving == true then return end -- IF NOT OF FLOOR DO NOT Open
  510. if Floor.Value == 1 and FireLock then return end
  511. if DoorState == "Open" or DoorState ~= "Closed" and DoorState == "Opening" and Nudge == true then
  512. if Nudge == true then
  513. DoorNudge = true
  514. coroutine.resume(coroutine.create(function()
  515. while DoorState ~= "Closed" do
  516. Car.Platform.Nudge:Play()
  517. wait(2)
  518. end
  519. end))
  520. end
  521. repeat wait() until DoorState == "Open"
  522. SetCarDirInd(0)
  523. SetFloorDirInd(0)
  524. DoorState = "Closing"
  525. local DoorFloorLeft = TFloors:FindFirstChild("Floor"..F):FindFirstChild("DoorLeft"):GetChildren()
  526. local DoorFloorRight = TFloors:FindFirstChild("Floor"..F):FindFirstChild("DoorRight"):GetChildren()
  527. script.Parent.Doors.Value = "Closed"
  528. wait(0.4)
  529.  
  530. local DOFL = TFloors:FindFirstChild("Floor"..F):FindFirstChild("DoorLeft"):GetChildren()
  531. local DOFR = TFloors:FindFirstChild("Floor"..F):FindFirstChild("DoorRight"):GetChildren()
  532.  
  533. for i=0, DoorCL do
  534. if DoorState == "CancelReopen" then DoorState = "OkReopen" return end
  535. DoorP = DoorP - 1
  536. for R=1, #DOFR do
  537. DOFR[R].CFrame = DOFR[R].CFrame * CFrame.new(-DoorC, 0, 0)
  538. end
  539. for L=1, #DOFL do
  540. DOFL[L].CFrame = DOFL[L].CFrame * CFrame.new(DoorC, 0, 0)
  541. end
  542. for i,l in pairs(Car.Level.DoorRight:GetChildren()) do
  543. l.C1 = l.C1 * CFrame.new(DoorCC, 0, 0)
  544. end
  545. for i,l in pairs(Car.Level.DoorLeft:GetChildren()) do
  546. l.C1 = l.C1 * CFrame.new(-DoorCC, 0, 0)
  547. end
  548. if Nudge or SlowClose or DoorP < 7 then wait(0.066) else wait(DoorSpeed) end
  549. end
  550. if DoorState == "CancelReopen" then DoorState = "OkReopen" return end
  551. if DoorState == "Closing" then
  552. if Nudge == true then DoorNudge = false end
  553. DoorState = "Closed"
  554. Quene(0,"Check")
  555. end
  556. end
  557. Car.Platform.Nudge:Stop()
  558. end
  559.  
  560.  
  561. function RearDoorOpen(F,ReOpen)
  562. print("FUNCTION NOT AVAILABLE")
  563. end
  564. function RearDoorClose(F,Nudge)
  565. print("FUNCTION NOT AVAILABLE")
  566. end
  567.  
  568.  
  569. Running = false
  570.  
  571. function DoorCheck()
  572. if Running then return end
  573. if FireLock then return end
  574. if DoorOpenTime == 0 then
  575. coroutine.resume(coroutine.create (function()
  576. Running = true
  577. while DoorOpenTime ~= NudgeTimer do
  578. if DoorState == "Closed" or FireLock or DoorHold then break end
  579. DoorOpenTime = DoorOpenTime + 1
  580. print("Nudge timer: "..DoorOpenTime)
  581. wait(1)
  582. end
  583. if DoorState ~= "Closed" or DoorStateRear ~= "Closed" then
  584. coroutine.resume(coroutine.create(function()
  585. repeat wait() until DoorState == "Open" or DoorState == "Closed"
  586. if DoorState == "Closed" then
  587. return -- No takk
  588. elseif DoorState == "Open" then
  589. DoorClose(Floor.Value,true)
  590. end
  591. end))
  592.  
  593.  
  594.  
  595. DoorOpenTime = 0
  596. Running = false
  597. end
  598. DoorOpenTime = 0
  599. Running = false
  600. end))
  601. end
  602. end
  603.  
  604. function DoorTimerX(Rear)
  605. for i=0,DoorTimer do
  606. if Rear == true then
  607. if DoorStateRear ~= "Open" then return end
  608. else
  609. if DoorState ~= "Open" then return end
  610. end
  611. wait(0.1)
  612. end
  613. if Rear == true then
  614. if DoorStateRear ~= "Open" then return end
  615. else
  616. if DoorState ~= "Open" then return end
  617. end
  618. if Rear == true then
  619. RearDoorClose(Floor.Value)
  620. else
  621. DoorClose(Floor.Value)
  622. end
  623. end
  624.  
  625.  
  626. if DoorSensors then
  627. Car.DoorSensor.Touched:connect(function (Player)
  628. if Player == nil then return end
  629. if Player.Parent == nil then return end
  630. if Player.Parent:FindFirstChild("Humanoid") then
  631. DoorTimerReset = true
  632. coroutine.resume(coroutine.create(function() if not Moving and DoorState == "Closing" then DoorReOpen(Floor.Value,true) end end))
  633. end
  634. end)
  635.  
  636. if Car:FindFirstChild("DoorSensorRear") then
  637. Car.DoorSensorRear.Touched:connect(function (Player)
  638. if Player == nil then return end
  639. if Player.Parent == nil then return end
  640. if Player.Parent:FindFirstChild("Humanoid") then
  641. coroutine.resume(coroutine.create(function() if not Moving and DoorStateRear == "Closing" then RearDoorOpen(Floor.Value,true) end end))
  642. end
  643.  
  644. end)
  645. end
  646. end
  647.  
  648.  
  649.  
  650. function Btn(xFloor,xMode,Type)
  651.  
  652. local xCar = TCar:FindFirstChild("BTF"..xFloor)
  653. local xCall = TFloors:FindFirstChild("Floor"..xFloor):FindFirstChild("CallButton")
  654. -- local xCall2 = TFloors:FindFirstChild("Floor"..xFloor):FindFirstChild("CallButton2")
  655.  
  656.  
  657. if xMode == 1 then
  658. for _,l in pairs(TCarG) do if l.Name == "BTF"..xFloor then wait(0.08) l.Button.BrickColor = BrickColor.new("New Yeller") end end
  659. if xCall ~= nil and Type == "Call" then
  660. xCall.BrickColor = BrickColor.new("New Yeller")
  661. end
  662. if xCall2 ~= nil and Type == "Call" then
  663. xCall2.BrickColor = BrickColor.new("New Yeller")
  664. end
  665. if TCar:FindFirstChild("FloorCall") then
  666. if TCar.FloorCall.SurfaceGui:FindFirstChild("F"..xFloor) then
  667. TCar.FloorCall.SurfaceGui:FindFirstChild("F"..xFloor).TextTransparency = 0
  668. end
  669. end
  670.  
  671. end
  672. if xMode == 0 then
  673. for _,l in pairs(TCarG) do if l.Name == "BTF"..xFloor then l.Button.BrickColor = BrickColor.new("Institutional white") end end
  674. if xCall ~= nil then
  675. xCall.BrickColor = BrickColor.new("Institutional white")
  676. end
  677. if xCall2 ~= nil then
  678. xCall2.BrickColor = BrickColor.new("Institutional white")
  679. end
  680. if xDual ~= nil then
  681. --xDual.Button.BrickColor = BrickColor.new("Institutional white")
  682. end
  683. if TCar:FindFirstChild("FloorCall") then
  684. if TCar.FloorCall.SurfaceGui:FindFirstChild("F"..xFloor) then
  685. TCar.FloorCall.SurfaceGui:FindFirstChild("F"..xFloor).TextTransparency = 1
  686. end
  687. end
  688. end
  689.  
  690. end
  691.  
  692. function SetCarDirInd(F,Dir)
  693.  
  694. if F == 1 then
  695. if MoveDirection == "Up" then
  696. for _,l in pairs(TCarG) do if l.Name == "BDirUp" then l.BrickColor = BrickColor.new("Forest green") end end
  697.  
  698. for _,l in pairs(TCarG) do if l.Name == "BDirMid" then l.BrickColor = BrickColor.new("Forest green") end end
  699. end
  700. if MoveDirection == "Down" then
  701. for _,l in pairs(TCarG) do if l.Name == "BDirDown" then l.BrickColor = BrickColor.new("Forest green") end end
  702.  
  703. for _,l in pairs(TCarG) do if l.Name == "BDirMid" then l.BrickColor = BrickColor.new("Forest green") end end
  704. end
  705. end
  706. if F == 0 then
  707. for _,l in pairs(TCarG) do if l.Name == "BDirUp" then l.BrickColor = BrickColor.new("Really black") end end
  708.  
  709. for _,l in pairs(TCarG) do if l.Name == "BDirMid" then l.BrickColor = BrickColor.new("Really black") end end
  710.  
  711. for _,l in pairs(TCarG) do if l.Name == "BDirDown" then l.BrickColor = BrickColor.new("Really black") end end
  712. end
  713.  
  714. end
  715. function DoChime()
  716.  
  717. local Chime = TCar.Platform.Chime
  718.  
  719. if MoveDirection == "Up" then
  720. Chime.Pitch = 1
  721. Chime:Play()
  722. elseif MoveDirection == "Down" then
  723. Chime.Pitch = 1
  724. Chime:Play()
  725. wait(0.7)
  726. Chime.Pitch = 1
  727. Chime:Play()
  728. elseif Floor.Value == TotalFloors then
  729. Chime.Pitch = 1
  730. Chime:Play()
  731. wait(0.7)
  732. Chime.Pitch = 1
  733. elseif Floor.Value == 1 then
  734. Chime.Pitch = 1
  735. Chime:Play()
  736. else
  737. Chime.Pitch = 1
  738. Chime:Play()
  739. end
  740.  
  741.  
  742.  
  743.  
  744.  
  745. end
  746. function SetFloorDirInd(F)
  747. if F == 1 then
  748. if MoveDirection == "Up" or Floor.Value == 1 then
  749. script.Parent.UD.Value = "U"
  750. for _,l in pairs(script.Parent.Floors["Floor"..Floor.Value]:GetChildren()) do if l.Name == "BDirUp" then l.BrickColor = BrickColor.new("Forest green") end end
  751. for _,l in pairs(script.Parent.Floors["Floor"..Floor.Value]:GetChildren()) do if l.Name == "BDirUp" then l.Material = "Neon" end end
  752. for _,l in pairs(script.Parent.Floors["Floor"..Floor.Value]:GetChildren()) do if l.Name == "M1" then l.BrickColor = BrickColor.new("Forest green") end end
  753. for _,l in pairs(script.Parent.Floors["Floor"..Floor.Value]:GetChildren()) do if l.Name == "M1" then l.Material = "Neon" end end
  754. script.DoChime.Value = true
  755. elseif MoveDirection == "Down" or Floor.Value == TotalFloors then
  756. --script.Parent.UD.Value = "D"
  757. for _,l in pairs(script.Parent.Floors["Floor"..Floor.Value]:GetChildren()) do if l.Name == "BDirDown" then l.BrickColor = BrickColor.new("Forest green") end end
  758. for _,l in pairs(script.Parent.Floors["Floor"..Floor.Value]:GetChildren()) do if l.Name == "BDirDown" then l.Material = "Neon" end end
  759. for _,l in pairs(script.Parent.Floors["Floor"..Floor.Value]:GetChildren()) do if l.Name == "M1" then l.BrickColor = BrickColor.new("Forest green") end end
  760. for _,l in pairs(script.Parent.Floors["Floor"..Floor.Value]:GetChildren()) do if l.Name == "M1" then l.Material = "Neon" end end
  761. script.DoChime.Value = true
  762. else
  763.  
  764. end
  765. end
  766. if F == 0 then
  767. script.Parent.UD.Value = "N"
  768. for _,l in pairs(script.Parent.Floors["Floor"..Floor.Value]:GetChildren()) do if l.Name == "BDirUp" then l.BrickColor = BrickColor.new("Really black") end end
  769. for _,l in pairs(script.Parent.Floors["Floor"..Floor.Value]:GetChildren()) do if l.Name == "BDirDown" then l.BrickColor = BrickColor.new("Really black") end end
  770. for _,l in pairs(script.Parent.Floors["Floor"..Floor.Value]:GetChildren()) do if l.Name == "BDirUp" then l.Material = "SmoothPlastic" end end
  771. for _,l in pairs(script.Parent.Floors["Floor"..Floor.Value]:GetChildren()) do if l.Name == "BDirDown" then l.Material = "SmoothPlastic" end end
  772. for _,l in pairs(script.Parent.Floors["Floor"..Floor.Value]:GetChildren()) do if l.Name == "M1" then l.BrickColor = BrickColor.new("Really black") end end
  773. for _,l in pairs(script.Parent.Floors["Floor"..Floor.Value]:GetChildren()) do if l.Name == "M1" then l.Material = "SmoothPlastic" end end
  774. script.DoChime.Value = false
  775. end
  776. end
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799.  
  800.  
  801.  
  802.  
  803.  
  804.  
  805.  
  806. function Quene(TF,MO,CC)
  807. if Debug then print("Quene start..., Type: "..MO.." Target: "..TF) end
  808.  
  809. if MO == "Check" then
  810. if Debug then print("Checking..") end
  811.  
  812.  
  813. -- Check Regular Quene
  814. for i = 1, #CallQuene do
  815. if CallQuene[i] ~= nil then
  816. ProcessCall(Floor.Value, CallQuene[i])
  817. end
  818. end
  819.  
  820. return
  821. end
  822.  
  823. if MO == "Add" then
  824. if Debug then print("Running Add quene") end
  825. if Fire then return end
  826. Btn(TF,1,CC)
  827. if Debug then print("Checking if it is at floor idle") end
  828. -- If Elevator is at Floor and Idle
  829. if TF == Floor.Value and not Busy and not Moving then
  830. if DoorState == "Closed" then
  831. DoorRun(1)
  832. elseif DoorState == "Closing" then
  833. DoorRun(3)
  834. end
  835. Btn(TF,0,CC)
  836. return
  837. end
  838. if Debug then print("Checking if locked") end
  839.  
  840. -- If not Then check if floor is locked
  841. if CC == "Car" then
  842. if CardLock then
  843. for i = 1, #LockedFloors do
  844. if LockedFloors[i] == TF then
  845. if UnlockedFloor == LockedFloors[i] or UnlockedFloor == 0 then
  846.  
  847. print("Ignoring lock")
  848. else
  849. print("Floor Locked...")
  850. Btn(TF,0,CC)
  851. return
  852. end
  853. end
  854. end
  855. end
  856. end
  857.  
  858. if Debug then print("Checking if it exist") end
  859. for i = 1, #CallQuene do
  860. if CallQuene[i] == TF then
  861. print("Call exist, Not adding floor: "..CallQuene[i])
  862. return
  863. end
  864. end
  865. if Debug then print("Inserting call") end
  866. -- Nope, Then we can add a call to it
  867.  
  868. table.insert(CallQuene,TF)
  869. if not Busy then Quene(0,"Check") end
  870. return
  871. end
  872.  
  873.  
  874. -- NEXT
  875. if MO == "Remove" then
  876.  
  877. for i = 1, #CallQuene do
  878. if CallQuene[i] == TF then
  879. print("Removed: "..CallQuene[i])
  880. CallQuene[i] = nil
  881. end
  882. end
  883. for i,l in pairs(DCalls) do
  884. if TF == l[2] then
  885. print("Removed call from DestCall")
  886. table.remove(DCalls,i)
  887. end
  888. end
  889. return
  890. end
  891. end
  892.  
  893.  
  894.  
  895.  
  896.  
  897. function DoAlarm(Player)
  898. if not Alarm then
  899. Alarm = true
  900. local g = Instance.new("Hint",Workspace)
  901. g.Text = "Attention, Elevator "..script.Parent.Elevator.Value.."'s Alarm was pressed by "..Player.Name
  902. TCar.Platform.Alarm.SoundId = "http://www.roblox.com/asset/?id=143969690"
  903. TCar.Platform.Alarm.Looped = true
  904. TCar.Platform.Alarm.Pitch = 1
  905. wait(0.5)
  906. TCar.Platform.Alarm:Play()
  907. wait(5)
  908. TCar.Platform.Alarm.Looped = false
  909. TCar.Platform.Alarm:Stop()
  910.  
  911.  
  912. TCar.Platform.Alarm.SoundId = "http://www.roblox.com/asset/?id=12721064"
  913. TCar.Platform.Alarm.Looped = false
  914. wait(1)
  915. TCar.Platform.Alarm:Play()
  916. TCar.Platform.Alarm.Pitch = 1
  917. wait(3)
  918. TCar.Platform.Alarm.SoundId = "http://www.roblox.com/asset/?id=12721071"
  919. TCar.Platform.Alarm.Looped = false
  920. TCar.Platform.Alarm.Pitch = 1
  921. for i=1,3 do
  922. TCar.Platform.Alarm:Play()
  923. wait(2)
  924. end
  925.  
  926. --[[
  927. TCar.Platform.Alarm.SoundId = "http://www.roblox.com/asset/?id=142628192"
  928. TCar.Platform.Alarm.Looped = false
  929. TCar.Platform.Alarm.Pitch = 1
  930. wait(0.5)
  931. TCar.Platform.Alarm:Play()
  932. wait(25)
  933. TCar.Platform.Alarm.SoundId = "http://www.roblox.com/asset/?id=130772180"
  934. TCar.Platform.Alarm.Looped = false
  935. TCar.Platform.Alarm.Pitch = 1
  936. wait(0.5)
  937. TCar.Platform.Alarm:Play()
  938. wait(1)
  939. ]]--
  940. TCar.Platform.Alarm.SoundId = "http://www.roblox.com/asset/?id=138254180"
  941. TCar.Platform.Alarm.Looped = false
  942. TCar.Platform.Alarm.Pitch = 1
  943. wait(0.5)
  944. TCar.Platform.Alarm:Play()
  945. wait(3)
  946. TCar.Platform.Alarm.SoundId = "http://www.roblox.com/asset/?id=138187085"
  947. TCar.Platform.Alarm.Looped = false
  948. TCar.Platform.Alarm.Pitch = 1
  949. wait(0.5)
  950. TCar.Platform.Alarm:Play()
  951. wait(1)
  952. g:Destroy()
  953. Alarm = false
  954. end
  955. end
  956.  
  957.  
  958. x = script.Parent.Floors:GetChildren()
  959. cs = Car:GetChildren()
  960.  
  961.  
  962. for i,l in pairs(x) do
  963. TotalFloors = TotalFloors + 1
  964.  
  965.  
  966. if TFloorsG[i]:FindFirstChild("CallButton") then
  967. TFloorsG[i].CallButton.ClickDetector.MouseClick:connect(function() if not ConfigMode then Quene(tonumber(TFloorsG[i].Name:sub(6)),"Add","Call") end end)
  968. --TFloorsG[i].CallButton.Texture.Texture = BtnULit
  969. end
  970.  
  971. if TFloorsG[i]:FindFirstChild("CallButton2") then
  972. TFloorsG[i].CallButton2.ClickDetector.MouseClick:connect(function() if not ConfigMode then Quene(tonumber(TFloorsG[i].Name:sub(6)),"Add","Call") end end)
  973. --TFloorsG[i].CallButton2.Texture.Texture = BtnULit
  974. end
  975. end
  976.  
  977.  
  978. if TCar:FindFirstChild("CardReader") ~= nil then
  979. TCar:FindFirstChild("CardReader").Touched:connect(function (Card)
  980. local Accepted = false
  981. if Card.Parent.Name ~= "ConfigKey" and Card.Parent:FindFirstChild("CardNumber") ~= nil and CardLock then
  982.  
  983. for i,l in pairs(CardNumber) do
  984. if Card.Parent.CardNumber.Value == i then
  985. TCar.CardReader.BrickColor = BrickColor.new("Bright green")
  986. UnlockedFloor = l
  987. --CardLock = false
  988. wait(5)
  989. UnlockedFloor = 99999
  990. --CardLock = true
  991. TCar.CardReader.BrickColor = BrickColor.new("New Yeller")
  992. Accepted = true
  993. end
  994. wait()
  995. end
  996. if not Accepted then
  997. TCar.CardReader.BrickColor = BrickColor.new("Really red")
  998. wait(1)
  999. TCar.CardReader.BrickColor = BrickColor.new("New Yeller")
  1000. end
  1001. end
  1002. end)
  1003. end
  1004.  
  1005.  
  1006.  
  1007. for i = 1, #TCarG do
  1008.  
  1009.  
  1010. if TCarG[i].Name:sub(1,2) == "BT" then
  1011. TCarG[i].Button.ClickDetector.MouseClick:connect(function() TCar.Platform.Beep:Play() end)
  1012. end
  1013.  
  1014. if TCarG[i].Name:sub(1,5) == "BTRST" then
  1015. TCarG[i].Button.ClickDetector.MouseClick:connect(function()
  1016. if DoorState == "Closed" then
  1017. --TCarG[i].Texture.Texture = BtnLit
  1018. script.Reset.Disabled = false
  1019. end
  1020. end)
  1021. end
  1022.  
  1023. if TCarG[i].Name:sub(1,5) == "BTSTP" then
  1024. TCarG[i].Button.ClickDetector.MouseClick:connect(function()
  1025. if Stop == false then
  1026. Stop = true
  1027. for i=1,#CallQuene do CallQuene[i] = nil end
  1028. --for i=1,TotalFloors do TCar["BTF"..i].Texture.Texture = BtnULit end
  1029. --TCarG[i].Texture.Texture = BtnLit
  1030. else
  1031. Stop = false
  1032. --TCarG[i].Texture.Texture = BtnULit
  1033. end
  1034. end)
  1035. end
  1036.  
  1037. if TCarG[i].Name:sub(1,5) == "BTSLC" then
  1038. TCarG[i].Button.ClickDetector.MouseClick:connect(function()
  1039. if SlowClose == false then
  1040. SlowClose = true
  1041. --TCarG[i].Texture.Texture = BtnLit
  1042. else
  1043. SlowClose = false
  1044. --TCarG[i].Texture.Texture = BtnULit
  1045. end
  1046. end)
  1047. end
  1048. if TCarG[i].Name:sub(1,5) == "BTDIS" then
  1049. TCarG[i].Button.ClickDetector.MouseClick:connect(function()
  1050. if script.Parent.Disabled.Value == false then
  1051. script.Parent.Disabled.Value = true
  1052. --TCarG[i].Texture.Texture = BtnLit
  1053. else
  1054. script.Parent.Disabled.Value = false
  1055. --TCarG[i].Texture.Texture = BtnULit
  1056. end
  1057. end)
  1058. end
  1059. if TCarG[i].Name:sub(1,5) == "BTDHO" then
  1060. TCarG[i].Button.ClickDetector.MouseClick:connect(function()
  1061. if DoorHold == false then
  1062. DoorHold = true
  1063. --TCarG[i].Texture.Texture = BtnLit
  1064. else
  1065. DoorHold = false
  1066. --TCarG[i].Texture.Texture = BtnULit
  1067. end
  1068. end)
  1069. end
  1070. if TCarG[i].Name:sub(1,5) == "BTEFA" then
  1071. TCarG[i].Button.ClickDetector.MouseClick:connect(function()
  1072. if script.Parent.FireMode.Value == false then
  1073. script.Parent.FireMode.Value = true
  1074. --TCarG[i].Texture.Texture = BtnLit
  1075. else
  1076. script.Parent.FireMode.Value = false
  1077. --TCarG[i].Texture.Texture = BtnULit
  1078. end
  1079. end)
  1080. end
  1081.  
  1082.  
  1083.  
  1084. if TCarG[i].Name:sub(1,4) == "BTDO" then
  1085. local BO = false
  1086. TCarG[i].Button.ClickDetector.MouseClick:connect(function()
  1087. if not FireLock and not Stop then
  1088. if not BO then
  1089. Bo = true
  1090. --TCarG[i].Texture.Texture = BtnLit
  1091. if not Moving and DoorState == "Closed" then DoorRun(1)
  1092. elseif DoorState == "Closing" then DoorRun(3) end
  1093. wait(0.2)
  1094. --TCarG[i].Texture.Texture = BtnULit
  1095. Bo = false
  1096. end
  1097. end
  1098. end)
  1099.  
  1100. end
  1101. if TCarG[i].Name:sub(1,4) == "BTDC" then
  1102. local BC = false
  1103. TCarG[i].Button.ClickDetector.MouseClick:connect(function()
  1104. if not FireLock and not Stop then
  1105. if not BC then
  1106. BC = true
  1107. --TCarG[i].Texture.Texture = BtnLit
  1108. DoorRun(2)
  1109. wait(0.2)
  1110. --TCarG[i].Texture.Texture = BtnULit
  1111. BC = false
  1112. end
  1113. end
  1114. end)
  1115. end
  1116.  
  1117.  
  1118. if TCarG[i].Name:sub(1,3) == "BTF" then
  1119. TCarG[i].Button.ClickDetector.MouseClick:connect(function()
  1120. if not FireLock and not Stop then
  1121. Quene(tonumber(TCarG[i].Name:sub(4)),"Add","Car")
  1122. end end)
  1123.  
  1124. end
  1125.  
  1126. if TCarG[i].Name:sub(1,4) == "BTAL" then
  1127. TCarG[i].Button.ClickDetector.MouseClick:connect(DoAlarm)
  1128. end
  1129.  
  1130.  
  1131. end
  1132.  
  1133.  
  1134.  
  1135.  
  1136.  
  1137. script.Parent.ScriptCall.Changed:connect(function ()
  1138. if script.Parent.ScriptCall.Value ~= -100 then
  1139. Quene(script.Parent.ScriptCall.Value,"Add",true)
  1140. script.Parent.ScriptCall.Value = -100
  1141. end
  1142. end)
  1143.  
  1144.  
  1145. script.Parent.FireMode.Changed:connect(function ()
  1146. if script.Parent.FireMode.Value == true then
  1147.  
  1148. FireLock = true
  1149. Locked = true
  1150. TCar.BTEFA.Texture.Texture = BtnLit
  1151. TCar.Platform.Fire:Play()
  1152. for i=1, TotalFloors do
  1153. TCar["BTF"..i].Texture.Texture = BtnULit
  1154. end
  1155. for i=1,#CallQuene do
  1156. CallQuene[i] = nil
  1157. end
  1158. TCar.BTDHO.Texture.Texture = BtnULit
  1159. DoorHold = false
  1160. wait(1)
  1161. Quene(1,"Add","Car")
  1162. coroutine.resume(coroutine.create(function()
  1163. repeat
  1164. if DoorState ~= "Closed" and Floor.Value ~= 1 then
  1165. repeat wait() until DoorState == "Open" or DoorState == "Closed"
  1166. if DoorState == "Open" then
  1167. coroutine.resume(coroutine.create(function() DoorClose(Floor.Value,true) end))
  1168. while DoorState ~= "Closed" and not DoorState == "Closed" do
  1169. Car.Platform.Chime:Play()
  1170. wait(0.3)
  1171. end
  1172. else return end
  1173. end
  1174. wait()
  1175. Quene(1,"Add","Car")
  1176. until Floor.Value == 1
  1177. end))
  1178. repeat wait() until Floor.Value == 1
  1179. TCar.Platform.Fire:Stop()
  1180. else
  1181. TCar.Platform.Fire:Stop()
  1182. TCar.BTEFA.Texture.Texture = BtnULit
  1183. Fire = false
  1184. FireLock = false
  1185. Locked = false
  1186. coroutine.resume(coroutine.create(function() DoorClose(Floor.Value,false) end))
  1187. end
  1188. end)
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194. Floor.Changed:connect(function()
  1195. if FloorPassChime then
  1196. Car.Platform.FloorPassChime:Play()
  1197. end
  1198. end)
  1199.  
  1200.  
  1201.  
  1202. print("Total floors for this elevator: "..TotalFloors)
  1203.  
  1204.  
  1205.  
  1206.  
  1207.  
  1208.  
  1209.  
  1210. Motor.Changed:connect(function()
  1211. BV.velocity = Vector3.new(0,Motor.Value,0)
  1212. end)
  1213.  
  1214.  
  1215.  
  1216.  
  1217.  
  1218.  
  1219. for i,l in pairs(Car.DR:GetChildren()) do
  1220. DoWeld(Car.Level,l).Parent = Car.Level.DoorRight
  1221. end
  1222. for i,l in pairs(Car.DL:GetChildren()) do
  1223. DoWeld(Car.Level,l).Parent = Car.Level.DoorLeft
  1224. end
  1225.  
  1226. function StartWeld(ChildAbuse)
  1227. for _,l in pairs(ChildAbuse) do
  1228. if l:IsA("Part") or l:IsA("WedgePart") or l:IsA("CornerWedgePart") or l:IsA("Seat")then
  1229. local w = DoWeld(Car.Level,l)
  1230. w.Parent = Car.Welds
  1231. w.Name = l.Name.."WELD"
  1232. end
  1233. if l:IsA("Model") and l.Name ~= "DL" and l.Name ~= "DR" and l.Name ~= "Welds" then
  1234. StartWeld(l:GetChildren())
  1235. end
  1236. end
  1237. end
  1238. StartWeld(Car:GetChildren())
  1239. --[[
  1240. ButtonTextures = {
  1241. ["DDDIS"]=158175576,["EFA"]=158175560,["DHO"]=158229138,["SLC"]=158230637,["STP"]=158231350,["RST"]=158233241,
  1242. ["DO"]=144878365,["DC"]=144878349,["AL"]=144878970,["S0"]=144877405,["S1"]=144877410,["S2"]=144877413,["S3"]=144877418,["S4"]=144877421,["S5"]=144877426,
  1243. ["S6"]=144877430,["S7"]=144877436,["S8"]=144877442,["S9"]=144877449,["L1"]=146946090,["L2"]=146946097,["L3"]=146946110,["L4"]=146946116,["L5"]=146946126,
  1244. ["L6"]=146946135,["L7"]=146946148,["L8"]=146946189,["L9"]=146946196,["R0"]=146947263,["R1"]=146947269,["R2"]=146947282,["R3"]=146947294,["R4"]=146947304,
  1245. ["R5"]=146947310,["R6"]=146947315,["R7"]=146947323,["R8"]=146947333,["R9"]=146947343
  1246. }
  1247.  
  1248.  
  1249. for i = 1, #TCarG do
  1250. if TCarG[i].Name:sub(1,5) == "BTRST" then
  1251. TCarG[i].FloorNumberL.Texture = "http://www.roblox.com/asset/?id=0"
  1252. TCarG[i].FloorNumberR.Texture = "http://www.roblox.com/asset/?id=" .. ButtonTextures["RST"]
  1253. end
  1254. if TCarG[i].Name:sub(1,5) == "BTSTP" then
  1255. TCarG[i].FloorNumberL.Texture = "http://www.roblox.com/asset/?id=0"
  1256. TCarG[i].FloorNumberR.Texture = "http://www.roblox.com/asset/?id=" .. ButtonTextures["STP"]
  1257. end
  1258. if TCarG[i].Name:sub(1,5) == "BTDHO" then
  1259. TCarG[i].FloorNumberL.Texture = "http://www.roblox.com/asset/?id=0"
  1260. TCarG[i].FloorNumberR.Texture = "http://www.roblox.com/asset/?id=" .. ButtonTextures["DHO"]
  1261. end
  1262. if TCarG[i].Name:sub(1,5) == "BTSLC" then
  1263. TCarG[i].FloorNumberL.Texture = "http://www.roblox.com/asset/?id=0"
  1264. TCarG[i].FloorNumberR.Texture = "http://www.roblox.com/asset/?id=" .. ButtonTextures["SLC"]
  1265. end
  1266. if TCarG[i].Name:sub(1,5) == "BTDIS" then
  1267. TCarG[i].FloorNumberL.Texture = "http://www.roblox.com/asset/?id=0"
  1268. TCarG[i].FloorNumberR.Texture = "http://www.roblox.com/asset/?id=" .. ButtonTextures["DDDIS"]
  1269. end
  1270. if TCarG[i].Name:sub(1,5) == "BTEFA" then
  1271. TCarG[i].FloorNumberL.Texture = "http://www.roblox.com/asset/?id=0"
  1272. TCarG[i].FloorNumberR.Texture = "http://www.roblox.com/asset/?id=" .. ButtonTextures["EFA"]
  1273. end
  1274. if TCarG[i].Name:sub(1,4) == "BTAL" then
  1275. TCarG[i].FloorNumberL.Texture = "http://www.roblox.com/asset/?id=0"
  1276. TCarG[i].FloorNumberR.Texture = "http://www.roblox.com/asset/?id=" .. ButtonTextures["AL"]
  1277. end
  1278. if TCarG[i].Name:sub(1,4) == "BTDO" then
  1279. TCarG[i].FloorNumberL.Texture = "http://www.roblox.com/asset/?id=0"
  1280. TCarG[i].FloorNumberR.Texture = "http://www.roblox.com/asset/?id=" .. ButtonTextures["DO"]
  1281. end
  1282. if TCarG[i].Name:sub(1,4) == "BTDC" then
  1283. TCarG[i].FloorNumberL.Texture = "http://www.roblox.com/asset/?id=0"
  1284. TCarG[i].FloorNumberR.Texture = "http://www.roblox.com/asset/?id=" .. ButtonTextures["DC"]
  1285. end
  1286.  
  1287. if TCarG[i].Name:sub(1,3) == "BTF" then
  1288. if tonumber(TCarG[i].Name:sub(4)) < 10 then
  1289. TCarG[i].FloorNumberL.Texture = "http://www.roblox.com/asset/?id=0"
  1290. TCarG[i].FloorNumberR.Texture = "http://www.roblox.com/asset/?id=" .. ButtonTextures["S"..TCarG[i].Name:sub(4)]
  1291. end
  1292. if tonumber(TCarG[i].Name:sub(4)) > 9 then
  1293. TCarG[i].FloorNumberL.Texture = "http://www.roblox.com/asset/?id=" .. ButtonTextures["L"..TCarG[i].Name:sub(4,4)]
  1294. TCarG[i].FloorNumberR.Texture = "http://www.roblox.com/asset/?id=" .. ButtonTextures["R"..TCarG[i].Name:sub(5,5)]
  1295. end
  1296. end
  1297.  
  1298. if TCarG[i].Name:sub(1,2) == "BT" then
  1299. if TCarG[i]:FindFirstChild("Texture") then
  1300. TCarG[i].Texture.Texture = BtnULit
  1301. end
  1302. end
  1303.  
  1304. end
  1305.  
  1306.  
  1307.  
  1308. ]]
  1309.  
  1310. print("Execution of elevator controller done...")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement