Advertisement
TryHarderNoob

Roblox Truck Script

Jun 10th, 2016
849
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 59.04 KB | None | 0 0
  1. Health = 5500
  2. MaxHealth = 5500
  3. ToughnessMinorDamage = 400
  4. ToughnessMajorDamage = 600
  5. DriftAcceleration = -0.001
  6. DriftSteerDifficulty = 0.025
  7. DriftSteerPower = 25
  8. Acceleration = 0.003
  9. TopSpeed = 186
  10. Deceleration = 0.0075
  11. BrakePower = 0.01
  12. SteerDifficulty = 0.025
  13. SteerPower = 20
  14. TireFriction = 0.5
  15. TireElasticity = 1
  16. MasterColor = BrickColor.random()
  17. Wrecked = false
  18. Vehicle = Instance.new("Model")
  19. Vehicle.Name = "Car"
  20. Vehicle.Parent = Workspace
  21. Base = Instance.new("Part")
  22. Base.Name = "VehicleBase"
  23. Base.BrickColor = MasterColor
  24. Base.TopSurface = "Smooth"
  25. Base.BottomSurface = "Smooth"
  26. Base.FormFactor = "Custom"
  27. Base.Size = Vector3.new(8, 1, 17)
  28. Base.Friction = 1
  29. Base.Elasticity = 0
  30. Base.Parent = Vehicle
  31. Thrust = Instance.new("BodyVelocity")
  32. Thrust.P = 100
  33. Thrust.maxForce = Vector3.new(math.huge, 0, math.huge)
  34. Thrust.velocity = Vector3.new()
  35. Thrust.Parent = Base
  36. Steer = Instance.new("BodyGyro")
  37. Steer.maxTorque = Vector3.new(0, math.huge, 0)
  38. Steer.cframe = CFrame.new()
  39. Steer.P = 7500
  40. Steer.Parent = Base
  41. Instance.new("BodyForce", Base).force = Vector3.new(0, -2000, 0)
  42. Seat = Instance.new("VehicleSeat")
  43. Seat.CanCollide = false
  44. Seat.MaxSpeed = 0
  45. Seat.Torque = 0
  46. Seat.HeadsUpDisplay = false
  47. Seat.BrickColor = BrickColor.new("Black")
  48. Seat.TopSurface = "Smooth"
  49. Seat.BottomSurface = "Smooth"
  50. Seat.Size = Vector3.new(2, 1, 2)
  51. Seat.Parent = Vehicle
  52. Weld = Instance.new("Weld")
  53. Weld.Name = "Weld"
  54. Weld.Parent = Seat
  55. Weld.Part0 = Base
  56. Weld.Part1 = Seat
  57. Weld.C0 = CFrame.new(-2.5, 0.375, 0.25)
  58. Part = Instance.new("Part")
  59. Part.Name = "Front Left Seat Back"
  60. Part.BrickColor = BrickColor.new("Black")
  61. Part.TopSurface = "Smooth"
  62. Part.BottomSurface = "Smooth"
  63. Part.FormFactor = "Custom"
  64. Part.Size = Vector3.new(2, 3, 1)
  65. Part.Parent = Vehicle
  66. Mesh = Instance.new("SpecialMesh")
  67. Mesh.MeshType = "Brick"
  68. Mesh.Scale = Vector3.new(1, 1, 1)
  69. Mesh.Parent = Part
  70. Weld = Instance.new("Weld")
  71. Weld.Parent = Part
  72. Weld.Part0 = Base
  73. Weld.Part1 = Part
  74. Weld.C0 = CFrame.new(-2.5, 1.5, 1.25)
  75. Part = Instance.new("Part")
  76. Part.Name = "Front Left Seat Headrest 1"
  77. Part.BrickColor = BrickColor.new("Black")
  78. Part.TopSurface = "Smooth"
  79. Part.BottomSurface = "Smooth"
  80. Part.FormFactor = "Custom"
  81. Part.Size = Vector3.new(2, 1, 1)
  82. Part.Parent = Vehicle
  83. Mesh = Instance.new("SpecialMesh")
  84. Mesh.MeshType = "Brick"
  85. Mesh.Scale = Vector3.new(0.5, 0.5, 0.5)
  86. Mesh.Parent = Part
  87. Weld = Instance.new("Weld")
  88. Weld.Parent = Part
  89. Weld.Part0 = Base
  90. Weld.Part1 = Part
  91. Weld.C0 = CFrame.new(-2.5, 3, 1.25)
  92. Part = Instance.new("Part")
  93. Part.Name = "Front Left Seat Headrest 2"
  94. Part.BrickColor = BrickColor.new("Black")
  95. Part.TopSurface = "Smooth"
  96. Part.BottomSurface = "Smooth"
  97. Part.FormFactor = "Custom"
  98. Part.Size = Vector3.new(2, 1, 1)
  99. Part.Parent = Vehicle
  100. Mesh = Instance.new("SpecialMesh")
  101. Mesh.MeshType = "Brick"
  102. Mesh.Scale = Vector3.new(0.9, 1.1, 1)
  103. Mesh.Parent = Part
  104. Weld = Instance.new("Weld")
  105. Weld.Parent = Part
  106. Weld.Part0 = Base
  107. Weld.Part1 = Part
  108. Weld.C0 = CFrame.new(-2.5, 3.8, 1.25)
  109. Seat2 = Instance.new("VehicleSeat")
  110. Seat2.Name = "VehicleSeat2"
  111. Seat2.CanCollide = false
  112. Seat2.MaxSpeed = 0
  113. Seat2.Torque = 0
  114. Seat2.HeadsUpDisplay = false
  115. Seat2.BrickColor = BrickColor.new("Black")
  116. Seat2.TopSurface = "Smooth"
  117. Seat2.BottomSurface = "Smooth"
  118. Seat2.Size = Vector3.new(2, 1, 2)
  119. Seat2.Parent = Vehicle
  120. Weld = Instance.new("Weld")
  121. Weld.Parent = Seat2
  122. Weld.Part0 = Base
  123. Weld.Part1 = Seat2
  124. Weld.C0 = CFrame.new(2.5, 0.375, 0.5)
  125. Part = Instance.new("Part")
  126. Part.Name = "Front Right Seat Back"
  127. Part.BrickColor = BrickColor.new("Black")
  128. Part.TopSurface = "Smooth"
  129. Part.BottomSurface = "Smooth"
  130. Part.FormFactor = "Custom"
  131. Part.Size = Vector3.new(2, 3, 1)
  132. Part.Parent = Vehicle
  133. Mesh = Instance.new("SpecialMesh")
  134. Mesh.MeshType = "Brick"
  135. Mesh.Scale = Vector3.new(1, 1, 1)
  136. Mesh.Parent = Part
  137. Weld = Instance.new("Weld")
  138. Weld.Parent = Part
  139. Weld.Part0 = Base
  140. Weld.Part1 = Part
  141. Weld.C0 = CFrame.new(2.5, 1.5, 1.25)
  142. Part = Instance.new("Part")
  143. Part.Name = "Front Right Seat Headrest 1"
  144. Part.BrickColor = BrickColor.new("Black")
  145. Part.TopSurface = "Smooth"
  146. Part.BottomSurface = "Smooth"
  147. Part.FormFactor = "Custom"
  148. Part.Size = Vector3.new(2, 1, 1)
  149. Part.Parent = Vehicle
  150. Mesh = Instance.new("SpecialMesh")
  151. Mesh.MeshType = "Brick"
  152. Mesh.Scale = Vector3.new(0.5, 0.5, 0.5)
  153. Mesh.Parent = Part
  154. Weld = Instance.new("Weld")
  155. Weld.Parent = Part
  156. Weld.Part0 = Base
  157. Weld.Part1 = Part
  158. Weld.C0 = CFrame.new(2.5, 3, 1.25)
  159. Part = Instance.new("Part")
  160. Part.Name = "Front Right Seat Headrest 2"
  161. Part.BrickColor = BrickColor.new("Black")
  162. Part.TopSurface = "Smooth"
  163. Part.BottomSurface = "Smooth"
  164. Part.FormFactor = "Custom"
  165. Part.Size = Vector3.new(2, 1, 1)
  166. Part.Parent = Vehicle
  167. Mesh = Instance.new("SpecialMesh")
  168. Mesh.MeshType = "Brick"
  169. Mesh.Scale = Vector3.new(0.9, 1.1, 1)
  170. Mesh.Parent = Part
  171. Weld = Instance.new("Weld")
  172. Weld.Parent = Part
  173. Weld.Part0 = Base
  174. Weld.Part1 = Part
  175. Weld.C0 = CFrame.new(2.5, 3.8, 1.25)
  176. Part = Instance.new("Part")
  177. Part.Name = "Front Right Bumper"
  178. Part.BrickColor = MasterColor
  179. Part.TopSurface = "Smooth"
  180. Part.BottomSurface = "Smooth"
  181. Part.FormFactor = "Custom"
  182. Part.Size = Vector3.new(2, 1, 3)
  183. Part.Parent = Vehicle
  184. Mesh = Instance.new("SpecialMesh")
  185. Mesh.MeshType = "Brick"
  186. Mesh.Scale = Vector3.new(1, 1, 0.95)
  187. Mesh.Parent = Part
  188. Weld = Instance.new("Weld")
  189. Weld.Parent = Part
  190. Weld.Part0 = Base
  191. Weld.Part1 = Part
  192. Weld.C0 = CFrame.new(5, 0, -7.075)
  193. Part = Instance.new("Part")
  194. Part.Name = "Front Left Bumper"
  195. Part.BrickColor = MasterColor
  196. Part.TopSurface = "Smooth"
  197. Part.BottomSurface = "Smooth"
  198. Part.FormFactor = "Custom"
  199. Part.Size = Vector3.new(2, 1, 3)
  200. Part.Parent = Vehicle
  201. Mesh = Instance.new("SpecialMesh")
  202. Mesh.MeshType = "Brick"
  203. Mesh.Scale = Vector3.new(1, 1, 0.95)
  204. Mesh.Parent = Part
  205. Weld = Instance.new("Weld")
  206. Weld.Parent = Part
  207. Weld.Part0 = Base
  208. Weld.Part1 = Part
  209. Weld.C0 = CFrame.new(-5, 0, -7.075)
  210. Part = Instance.new("Part")
  211. Part.Name = "Right Skirt 1"
  212. Part.BrickColor = MasterColor
  213. Part.TopSurface = "Smooth"
  214. Part.BottomSurface = "Smooth"
  215. Part.FormFactor = "Custom"
  216. Part.Size = Vector3.new(1, 1, 9)
  217. Part.Parent = Vehicle
  218. Mesh = Instance.new("SpecialMesh")
  219. Mesh.MeshType = "Brick"
  220. Mesh.Scale = Vector3.new(1, 1, 0.975)
  221. Mesh.Parent = Part
  222. Weld = Instance.new("Weld")
  223. Weld.Parent = Part
  224. Weld.Part0 = Base
  225. Weld.Part1 = Part
  226. Weld.C0 = CFrame.new(4.5, 0, 2)
  227. Part = Instance.new("Part")
  228. Part.Name = "Right Skirt 2"
  229. Part.BrickColor = MasterColor
  230. Part.TopSurface = "Smooth"
  231. Part.BottomSurface = "Smooth"
  232. Part.FormFactor = "Custom"
  233. Part.Size = Vector3.new(1, 1, 9)
  234. Part.Parent = Vehicle
  235. Mesh = Instance.new("SpecialMesh")
  236. Mesh.MeshType = "Brick"
  237. Mesh.Scale = Vector3.new(1, 0.5, 0.975)
  238. Mesh.Parent = Part
  239. Weld = Instance.new("Weld")
  240. Weld.Parent = Part
  241. Weld.Part0 = Base
  242. Weld.Part1 = Part
  243. Weld.C0 = CFrame.new(5.5, -0.25, 2)
  244. Part = Instance.new("Part")
  245. Part.Name = "Left Skirt 1"
  246. Part.BrickColor = MasterColor
  247. Part.TopSurface = "Smooth"
  248. Part.BottomSurface = "Smooth"
  249. Part.FormFactor = "Custom"
  250. Part.Size = Vector3.new(1, 1, 9)
  251. Part.Parent = Vehicle
  252. Mesh = Instance.new("SpecialMesh")
  253. Mesh.MeshType = "Brick"
  254. Mesh.Scale = Vector3.new(1, 1, 0.975)
  255. Mesh.Parent = Part
  256. Weld = Instance.new("Weld")
  257. Weld.Parent = Part
  258. Weld.Part0 = Base
  259. Weld.Part1 = Part
  260. Weld.C0 = CFrame.new(-4.5, 0, 2)
  261. Part = Instance.new("Part")
  262. Part.Name = "Left Skirt 2"
  263. Part.BrickColor = MasterColor
  264. Part.TopSurface = "Smooth"
  265. Part.BottomSurface = "Smooth"
  266. Part.FormFactor = "Custom"
  267. Part.Size = Vector3.new(1, 1, 9)
  268. Part.Parent = Vehicle
  269. Mesh = Instance.new("SpecialMesh")
  270. Mesh.MeshType = "Brick"
  271. Mesh.Scale = Vector3.new(1, 0.5, 0.975)
  272. Mesh.Parent = Part
  273. Weld = Instance.new("Weld")
  274. Weld.Parent = Part
  275. Weld.Part0 = Base
  276. Weld.Part1 = Part
  277. Weld.C0 = CFrame.new(-5.5, -0.25, 2)
  278. Part = Instance.new("Part")
  279. Part.Name = "VehicleEngine"
  280. Part.BrickColor = MasterColor
  281. Part.TopSurface = "Smooth"
  282. Part.BottomSurface = "Smooth"
  283. Part.FormFactor = "Custom"
  284. Part.Size = Vector3.new(12, 1, 3)
  285. Part.Parent = Vehicle
  286. Weld = Instance.new("Weld")
  287. Weld.Parent = Part
  288. Weld.Part0 = Base
  289. Weld.Part1 = Part
  290. Weld.C0 = CFrame.new(0, 1, -7)
  291. coroutine.wrap(function(Part2)
  292. while true do
  293. if Driver ~= nil and Part2:FindFirstChild("Drive") == nil and Part2:FindFirstChild("Start") == nil and Health > 0 then
  294. local Sound1 = Instance.new("Sound")
  295. Sound1.Name = "Start"
  296. Sound1.SoundId = "http://www.roblox.com/Asset/?id=31245452"
  297. Sound1.Volume = 1
  298. Sound1.Pitch = 0.95
  299. Sound1.Parent = Part2
  300. Sound1:Play()
  301. wait(1)
  302. local Sound2 = Instance.new("Sound")
  303. Sound2.Name = "Drive"
  304. Sound2.SoundId = "http://www.roblox.com/Asset/?id=2766576"
  305. Sound2.Volume = 1
  306. Sound2.Pitch = 0
  307. Sound2.Looped = true
  308. Sound2.Parent = Part2
  309. Sound2:Play()
  310. while Driver ~= nil and Vehicle.Parent ~= nil and Health > 0 do
  311. Sound2.Pitch = 0.05 + (math.abs(ThrottlePercent) * 0.2)
  312. wait()
  313. end
  314. coroutine.wrap(function()
  315. for i = Sound1.Pitch, 0, -0.075 do
  316. Sound1.Pitch = i
  317. wait()
  318. end
  319. end)()
  320. for i = Sound2.Pitch, 0, -0.01 do
  321. Sound2.Pitch = i
  322. wait()
  323. end
  324. Sound1:Stop()
  325. Sound2:Stop()
  326. wait(0.25)
  327. Sound1:Remove()
  328. Sound2:Remove()
  329. end
  330. wait()
  331. end
  332. end)(Part)
  333. Part = Instance.new("Part")
  334. Part.Name = "Grill"
  335. Part.BrickColor = BrickColor.new("Medium stone grey")
  336. Part.Reflectance = 0.2
  337. Part.TopSurface = "Smooth"
  338. Part.BottomSurface = "Smooth"
  339. Part.FormFactor = "Custom"
  340. Part.Size = Vector3.new(4, 1, 2)
  341. Part.Parent = Vehicle
  342. Weld = Instance.new("Weld")
  343. Weld.Parent = Part
  344. Weld.Part0 = Base
  345. Weld.Part1 = Part
  346. Weld.C0 = CFrame.new(0, 2, -7.5)
  347. Part = Instance.new("Part")
  348. Part.Name = "Right Headlight"
  349. Part.BrickColor = BrickColor.new("Institutional white")
  350. Part.Transparency = 0.5
  351. Part.TopSurface = "Smooth"
  352. Part.BottomSurface = "Smooth"
  353. Part.FormFactor = "Custom"
  354. Part.Size = Vector3.new(3, 1, 2)
  355. Part.Parent = Vehicle
  356. Weld = Instance.new("Weld")
  357. Weld.Parent = Part
  358. Weld.Part0 = Base
  359. Weld.Part1 = Part
  360. Weld.C0 = CFrame.new(3.5, 2, -7.5)
  361. Part = Instance.new("Part")
  362. Part.Name = "Right Front Turn Signal"
  363. Part.BrickColor = BrickColor.new("New Yeller")
  364. Part.Transparency = 0.5
  365. Part.TopSurface = "Smooth"
  366. Part.BottomSurface = "Smooth"
  367. Part.FormFactor = "Custom"
  368. Part.Size = Vector3.new(1, 1, 2)
  369. Part.Parent = Vehicle
  370. Weld = Instance.new("Weld")
  371. Weld.Parent = Part
  372. Weld.Part0 = Base
  373. Weld.Part1 = Part
  374. Weld.C0 = CFrame.new(5.5, 2, -7.5)
  375. Part = Instance.new("Part")
  376. Part.Name = "Left Headlight"
  377. Part.BrickColor = BrickColor.new("Institutional white")
  378. Part.Transparency = 0.5
  379. Part.TopSurface = "Smooth"
  380. Part.BottomSurface = "Smooth"
  381. Part.FormFactor = "Custom"
  382. Part.Size = Vector3.new(3, 1, 2)
  383. Part.Parent = Vehicle
  384. Weld = Instance.new("Weld")
  385. Weld.Parent = Part
  386. Weld.Part0 = Base
  387. Weld.Part1 = Part
  388. Weld.C0 = CFrame.new(-3.5, 2, -7.5)
  389. Part = Instance.new("Part")
  390. Part.Name = "Left Front Turn Signal"
  391. Part.BrickColor = BrickColor.new("New Yeller")
  392. Part.Transparency = 0.5
  393. Part.TopSurface = "Smooth"
  394. Part.BottomSurface = "Smooth"
  395. Part.FormFactor = "Custom"
  396. Part.Size = Vector3.new(1, 1, 2)
  397. Part.Parent = Vehicle
  398. Weld = Instance.new("Weld")
  399. Weld.Parent = Part
  400. Weld.Part0 = Base
  401. Weld.Part1 = Part
  402. Weld.C0 = CFrame.new(-5.5, 2, -7.5)
  403. Part = Instance.new("Part")
  404. Part.Name = "Headlight Back"
  405. Part.BrickColor = MasterColor
  406. Part.TopSurface = "Smooth"
  407. Part.BottomSurface = "Smooth"
  408. Part.FormFactor = "Custom"
  409. Part.Size = Vector3.new(12, 1, 4)
  410. Part.Parent = Vehicle
  411. Weld = Instance.new("Weld")
  412. Weld.Parent = Part
  413. Weld.Part0 = Base
  414. Weld.Part1 = Part
  415. Weld.C0 = CFrame.new(0, 2, -4.5)
  416. Part = Instance.new("WedgePart")
  417. Part.Name = "Hood"
  418. Part.BrickColor = MasterColor
  419. Part.TopSurface = "Smooth"
  420. Part.BottomSurface = "Smooth"
  421. Part.FormFactor = "Custom"
  422. Part.Size = Vector3.new(12, 1, 6)
  423. Part.Parent = Vehicle
  424. Weld = Instance.new("Weld")
  425. Weld.Parent = Part
  426. Weld.Part0 = Base
  427. Weld.Part1 = Part
  428. Weld.C0 = CFrame.new(0, 3, -5.5)
  429. Part = Instance.new("WedgePart")
  430. Part.Name = "Front Well 1"
  431. Part.BrickColor = MasterColor
  432. Part.TopSurface = "Smooth"
  433. Part.BottomSurface = "Smooth"
  434. Part.FormFactor = "Custom"
  435. Part.Size = Vector3.new(12, 1, 1)
  436. Part.Parent = Vehicle
  437. Mesh = Instance.new("SpecialMesh")
  438. Mesh.MeshType = "Wedge"
  439. Mesh.Scale = Vector3.new(1, 0.5, 0.5)
  440. Mesh.Parent = Part
  441. Weld = Instance.new("Weld")
  442. Weld.Parent = Part
  443. Weld.Part0 = Base
  444. Weld.Part1 = Part
  445. Weld.C0 = CFrame.new(0, 1.25, -5.25) * CFrame.fromEulerAnglesXYZ(math.rad(180), 0, 0)
  446. Part = Instance.new("WedgePart")
  447. Part.Name = "Front Well 2"
  448. Part.BrickColor = MasterColor
  449. Part.TopSurface = "Smooth"
  450. Part.BottomSurface = "Smooth"
  451. Part.FormFactor = "Custom"
  452. Part.Size = Vector3.new(12, 1, 1)
  453. Part.Parent = Vehicle
  454. Mesh = Instance.new("SpecialMesh")
  455. Mesh.MeshType = "Wedge"
  456. Mesh.Scale = Vector3.new(1, 0.5, 0.5)
  457. Mesh.Parent = Part
  458. Weld = Instance.new("Weld")
  459. Weld.Parent = Part
  460. Weld.Part0 = Base
  461. Weld.Part1 = Part
  462. Weld.C0 = CFrame.new(0, 1.25, -2.75) * CFrame.fromEulerAnglesXYZ(math.rad(180), math.rad(180), 0)
  463. Part = Instance.new("Part")
  464. Part.Name = "Front Well 3"
  465. Part.BrickColor = BrickColor.new("Black")
  466. Part.TopSurface = "Smooth"
  467. Part.BottomSurface = "Smooth"
  468. Part.FormFactor = "Custom"
  469. Part.Size = Vector3.new(8, 1, 3)
  470. Part.Parent = Vehicle
  471. Weld = Instance.new("Weld")
  472. Weld.Parent = Part
  473. Weld.Part0 = Base
  474. Weld.Part1 = Part
  475. Weld.C0 = CFrame.new(0, 1, -4)
  476. Part = Instance.new("Part")
  477. Part.Name = "Front Left Roof Support"
  478. Part.BrickColor = MasterColor
  479. Part.TopSurface = "Smooth"
  480. Part.BottomSurface = "Smooth"
  481. Part.FormFactor = "Custom"
  482. Part.Size = Vector3.new(1, 5, 1)
  483. Part.CanCollide = false
  484. Part.Parent = Vehicle
  485. Weld = Instance.new("Weld")
  486. Weld.Parent = Part
  487. Weld.Part0 = Base
  488. Weld.Part1 = Part
  489. Weld.C0 = CFrame.new(-5.5, 4.75, -1.75) * CFrame.fromEulerAnglesXYZ(math.rad(25), 0, 0)
  490. Part = Instance.new("Part")
  491. Part.Name = "Front Right Roof Support"
  492. Part.BrickColor = MasterColor
  493. Part.TopSurface = "Smooth"
  494. Part.BottomSurface = "Smooth"
  495. Part.FormFactor = "Custom"
  496. Part.Size = Vector3.new(1, 5, 1)
  497. Part.CanCollide = false
  498. Part.Parent = Vehicle
  499. Weld = Instance.new("Weld")
  500. Weld.Parent = Part
  501. Weld.Part0 = Base
  502. Weld.Part1 = Part
  503. Weld.C0 = CFrame.new(5.5, 4.75, -1.75) * CFrame.fromEulerAnglesXYZ(math.rad(25), 0, 0)
  504. Part = Instance.new("Part")
  505. Part.Name = "Front Window"
  506. Part.BrickColor = BrickColor.new("Institutional white")
  507. Part.Transparency = 0.75
  508. Part.TopSurface = "Smooth"
  509. Part.BottomSurface = "Smooth"
  510. Part.FormFactor = "Custom"
  511. Part.Size = Vector3.new(10, 5, 1)
  512. Part.Parent = Vehicle
  513. Weld = Instance.new("Weld")
  514. Weld.Parent = Part
  515. Weld.Part0 = Base
  516. Weld.Part1 = Part
  517. Weld.C0 = CFrame.new(0, 4.75, -1.75) * CFrame.fromEulerAnglesXYZ(math.rad(25), 0, 0)
  518. Part = Instance.new("Part")
  519. Part.Name = "Roof"
  520. Part.BrickColor = MasterColor
  521. Part.TopSurface = "Smooth"
  522. Part.BottomSurface = "Smooth"
  523. Part.FormFactor = "Custom"
  524. Part.Size = Vector3.new(12, 1, 4)
  525. Part.Parent = Vehicle
  526. Weld = Instance.new("Weld")
  527. Weld.Parent = Part
  528. Weld.Part0 = Base
  529. Weld.Part1 = Part
  530. Weld.C0 = CFrame.new(0, 6.729, 0.855)
  531. Part = Instance.new("Part")
  532. Part.Name = "Dashboard Back"
  533. Part.BrickColor = MasterColor
  534. Part.TopSurface = "Smooth"
  535. Part.BottomSurface = "Smooth"
  536. Part.FormFactor = "Custom"
  537. Part.Size = Vector3.new(12, 4, 1)
  538. Part.Parent = Vehicle
  539. Mesh = Instance.new("SpecialMesh")
  540. Mesh.MeshType = "Brick"
  541. Mesh.Scale = Vector3.new(1, 1, 0.5)
  542. Mesh.Parent = Part
  543. Weld = Instance.new("Weld")
  544. Weld.Parent = Part
  545. Weld.Part0 = Base
  546. Weld.Part1 = Part
  547. Weld.C0 = CFrame.new(0, 1.5, -2.25)
  548. Part = Instance.new("Part")
  549. Part.Name = "Steeringwheel"
  550. Part.BrickColor = BrickColor.new("Black")
  551. Part.TopSurface = "Smooth"
  552. Part.BottomSurface = "Smooth"
  553. Part.FormFactor = "Custom"
  554. Part.Size = Vector3.new(2, 2, 1)
  555. Part.CanCollide = false
  556. Part.Parent = Vehicle
  557. Mesh = Instance.new("SpecialMesh")
  558. Mesh.MeshType = "Sphere"
  559. Mesh.Scale = Vector3.new(1.25, 1.25, 0.5)
  560. Mesh.Parent = Part
  561. Weld = Instance.new("Weld")
  562. Weld.Parent = Part
  563. Weld.Part0 = Base
  564. Weld.Part1 = Part
  565. Weld.C0 = CFrame.new(-2.5, 3, -1.5)
  566. Part = Instance.new("Part")
  567. Part.Name = "Steering Column"
  568. Part.BrickColor = BrickColor.new("Black")
  569. Part.TopSurface = "Smooth"
  570. Part.BottomSurface = "Smooth"
  571. Part.FormFactor = "Custom"
  572. Part.Size = Vector3.new(1, 1, 1)
  573. Part.CanCollide = false
  574. Part.Parent = Vehicle
  575. Weld = Instance.new("Weld")
  576. Weld.Parent = Part
  577. Weld.Part0 = Base
  578. Weld.Part1 = Part
  579. Weld.C0 = CFrame.new(-2.5, 2.95, -1.9)
  580. Part = Instance.new("Part")
  581. Part.Name = "Left Turn Signal Button"
  582. Part.BrickColor = BrickColor.new("Bright green")
  583. Part.TopSurface = "Smooth"
  584. Part.BottomSurface = "Smooth"
  585. Part.FormFactor = "Custom"
  586. Part.Size = Vector3.new(0.5, 0.5, 0.5)
  587. Part.CanCollide = false
  588. Part.Parent = Vehicle
  589. Instance.new("CylinderMesh", Part)
  590. Weld = Instance.new("Weld")
  591. Weld.Parent = Part
  592. Weld.Part0 = Base
  593. Weld.Part1 = Part
  594. Weld.C0 = CFrame.new(-0.5, 2.5, -1.8) * CFrame.fromEulerAnglesXYZ(math.rad(90), 0, 0)
  595. local Open = Instance.new("ClickDetector")
  596. Open.Parent = Part
  597. coroutine.wrap(function(Part2, Weld2)
  598. local SignalOn = false
  599. Open.MouseClick:connect(function()
  600. SignalOn = not SignalOn
  601. Part2.BrickColor = SignalOn == true and BrickColor.new("Institutional white") or BrickColor.new("Bright green")
  602. coroutine.wrap(function()
  603. if SignalOn == true then
  604. for i = 0, 0.1, 0.01 do
  605. Weld2.C1 = CFrame.new(0, i, 0)
  606. wait()
  607. end
  608. Weld2.C1 = CFrame.new(0, 0.1, 0)
  609. else
  610. for i = 0.1, 0, -0.01 do
  611. Weld2.C1 = CFrame.new(0, i, 0)
  612. wait()
  613. end
  614. Weld2.C1 = CFrame.new(0, 0, 0)
  615. end
  616. end)()
  617. end)
  618. local i = false
  619. coroutine.wrap(function()
  620. while true do
  621. i = not i
  622. wait(0.5)
  623. end
  624. end)()
  625. while true do
  626. if Vehicle:FindFirstChild("Left Front Turn Signal") ~= nil then
  627. if Vehicle["Left Front Turn Signal"]:FindFirstChild("Weld") == nil or SignalOn == false or i == false then
  628. Vehicle["Left Front Turn Signal"].Transparency = 0.5
  629. else
  630. Vehicle["Left Front Turn Signal"].Transparency = 0
  631. end
  632. end
  633. if Vehicle:FindFirstChild("Left Rear Turn Signal") ~= nil then
  634. if Vehicle["Left Rear Turn Signal"]:FindFirstChild("Weld") == nil or SignalOn == false or i == false then
  635. Vehicle["Left Rear Turn Signal"].Transparency = 0.5
  636. else
  637. Vehicle["Left Rear Turn Signal"].Transparency = 0
  638. end
  639. end
  640. wait()
  641. end
  642. end)(Part, Weld)
  643. Part = Instance.new("Part")
  644. Part.Name = "Headlights Button"
  645. Part.BrickColor = BrickColor.new("New Yeller")
  646. Part.TopSurface = "Smooth"
  647. Part.BottomSurface = "Smooth"
  648. Part.FormFactor = "Custom"
  649. Part.Size = Vector3.new(0.5, 0.5, 0.5)
  650. Part.CanCollide = false
  651. Part.Parent = Vehicle
  652. Instance.new("CylinderMesh", Part)
  653. Weld = Instance.new("Weld")
  654. Weld.Parent = Part
  655. Weld.Part0 = Base
  656. Weld.Part1 = Part
  657. Weld.C0 = CFrame.new(0, 2.5, -1.8) * CFrame.fromEulerAnglesXYZ(math.rad(90), 0, 0)
  658. local Open = Instance.new("ClickDetector")
  659. Open.Parent = Part
  660. coroutine.wrap(function(Part2, Weld2)
  661. local HeadlightsOn = false
  662. Open.MouseClick:connect(function()
  663. HeadlightsOn = not HeadlightsOn
  664. Part2.BrickColor = HeadlightsOn == true and BrickColor.new("Institutional white") or BrickColor.new("New Yeller")
  665. coroutine.wrap(function()
  666. if HeadlightsOn == true then
  667. for i = 0, 0.1, 0.01 do
  668. Weld2.C1 = CFrame.new(0, i, 0)
  669. wait()
  670. end
  671. Weld2.C1 = CFrame.new(0, 0.1, 0)
  672. else
  673. for i = 0.1, 0, -0.01 do
  674. Weld2.C1 = CFrame.new(0, i, 0)
  675. wait()
  676. end
  677. Weld2.C1 = CFrame.new(0, 0, 0)
  678. end
  679. end)()
  680. end)
  681. while true do
  682. if Vehicle:FindFirstChild("Left Headlight") ~= nil then
  683. if Vehicle["Left Headlight"]:FindFirstChild("Weld") == nil or HeadlightsOn == false then
  684. Vehicle["Left Headlight"].Transparency = 0.5
  685. else
  686. Vehicle["Left Headlight"].Transparency = 0
  687. end
  688. end
  689. if Vehicle:FindFirstChild("Right Headlight") ~= nil then
  690. if Vehicle["Right Headlight"]:FindFirstChild("Weld") == nil or HeadlightsOn == false then
  691. Vehicle["Right Headlight"].Transparency = 0.5
  692. else
  693. Vehicle["Right Headlight"].Transparency = 0
  694. end
  695. end
  696. wait()
  697. end
  698. end)(Part, Weld)
  699. Part = Instance.new("Part")
  700. Part.Name = "Right Turn Signal Button"
  701. Part.BrickColor = BrickColor.new("Bright green")
  702. Part.TopSurface = "Smooth"
  703. Part.BottomSurface = "Smooth"
  704. Part.FormFactor = "Custom"
  705. Part.Size = Vector3.new(0.5, 0.5, 0.5)
  706. Part.CanCollide = false
  707. Part.Parent = Vehicle
  708. Instance.new("CylinderMesh", Part)
  709. Weld = Instance.new("Weld")
  710. Weld.Parent = Part
  711. Weld.Part0 = Base
  712. Weld.Part1 = Part
  713. Weld.C0 = CFrame.new(0.5, 2.5, -1.8) * CFrame.fromEulerAnglesXYZ(math.rad(90), 0, 0)
  714. local Open = Instance.new("ClickDetector")
  715. Open.Parent = Part
  716. coroutine.wrap(function(Part2, Weld2)
  717. local SignalOn = false
  718. Open.MouseClick:connect(function()
  719. SignalOn = not SignalOn
  720. Part2.BrickColor = SignalOn == true and BrickColor.new("Institutional white") or BrickColor.new("Bright green")
  721. coroutine.wrap(function()
  722. if SignalOn == true then
  723. for i = 0, 0.1, 0.01 do
  724. Weld2.C1 = CFrame.new(0, i, 0)
  725. wait()
  726. end
  727. Weld2.C1 = CFrame.new(0, 0.1, 0)
  728. else
  729. for i = 0.1, 0, -0.01 do
  730. Weld2.C1 = CFrame.new(0, i, 0)
  731. wait()
  732. end
  733. Weld2.C1 = CFrame.new(0, 0, 0)
  734. end
  735. end)()
  736. end)
  737. local i = false
  738. coroutine.wrap(function()
  739. while true do
  740. i = not i
  741. wait(0.5)
  742. end
  743. end)()
  744. while true do
  745. if Vehicle:FindFirstChild("Right Front Turn Signal") ~= nil then
  746. if Vehicle["Right Front Turn Signal"]:FindFirstChild("Weld") == nil or SignalOn == false or i == false then
  747. Vehicle["Right Front Turn Signal"].Transparency = 0.5
  748. else
  749. Vehicle["Right Front Turn Signal"].Transparency = 0
  750. end
  751. if Vehicle:FindFirstChild("Right Rear Turn Signal") ~= nil then
  752. if Vehicle["Right Rear Turn Signal"]:FindFirstChild("Weld") == nil or SignalOn == false or i == false then
  753. Vehicle["Right Rear Turn Signal"].Transparency = 0.5
  754. else
  755. Vehicle["Right Rear Turn Signal"].Transparency = 0
  756. end
  757. end
  758. end
  759. wait()
  760. end
  761. end)(Part, Weld)
  762. Part = Instance.new("Part")
  763. Part.Name = "Front Left Door"
  764. Part.BrickColor = MasterColor
  765. Part.TopSurface = "Smooth"
  766. Part.BottomSurface = "Smooth"
  767. Part.FormFactor = "Custom"
  768. Part.Size = Vector3.new(1, 3, 4)
  769. Part.Parent = Vehicle
  770. Weld = Instance.new("Weld")
  771. Weld.Parent = Part
  772. Weld.Part0 = Base
  773. Weld.Part1 = Part
  774. Weld.C0 = CFrame.new(-6, 1.5, -2)
  775. Weld.C1 = CFrame.new(-0.5, 0, -2)
  776. local Open = Instance.new("ClickDetector")
  777. Open.Parent = Part
  778. coroutine.wrap(function(Weld2)
  779. local IsOpen = false
  780. local CanOpen = true
  781. Open.MouseClick:connect(function()
  782. if IsOpen == false and CanOpen == true then
  783. CanOpen = false
  784. IsOpen = true
  785. for i = 0, 1, 0.1 do
  786. Weld2.C1 = CFrame.new(Weld2.C1.p) * CFrame.fromEulerAnglesXYZ(0, math.rad(90 * i), 0)
  787. wait()
  788. end
  789. CanOpen = true
  790. elseif IsOpen == true and CanOpen == true then
  791. CanOpen = false
  792. IsOpen = false
  793. for i = 1, 0, -0.1 do
  794. Weld2.C1 = CFrame.new(Weld2.C1.p) * CFrame.fromEulerAnglesXYZ(0, math.rad(90 * i), 0)
  795. wait()
  796. end
  797. CanOpen = true
  798. end
  799. end)
  800. end)(Weld)
  801. Part = Instance.new("Part")
  802. Part.Name = "Front Right Door"
  803. Part.BrickColor = MasterColor
  804. Part.TopSurface = "Smooth"
  805. Part.BottomSurface = "Smooth"
  806. Part.FormFactor = "Custom"
  807. Part.Size = Vector3.new(1, 3, 4)
  808. Part.Parent = Vehicle
  809. Weld = Instance.new("Weld")
  810. Weld.Parent = Part
  811. Weld.Part0 = Base
  812. Weld.Part1 = Part
  813. Weld.C0 = CFrame.new(6, 1.5, -2)
  814. Weld.C1 = CFrame.new(0.5, 0, -2)
  815. local Open = Instance.new("ClickDetector")
  816. Open.Parent = Part
  817. coroutine.wrap(function(Weld2)
  818. local IsOpen = false
  819. local CanOpen = true
  820. Open.MouseClick:connect(function()
  821. if IsOpen == false and CanOpen == true then
  822. CanOpen = false
  823. IsOpen = true
  824. for i = 0, 1, 0.1 do
  825. Weld2.C1 = CFrame.new(Weld2.C1.p) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90 * i), 0)
  826. wait()
  827. end
  828. CanOpen = true
  829. elseif IsOpen == true and CanOpen == true then
  830. CanOpen = false
  831. IsOpen = false
  832. for i = 1, 0, -0.1 do
  833. Weld2.C1 = CFrame.new(Weld2.C1.p) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90 * i), 0)
  834. wait()
  835. end
  836. CanOpen = true
  837. end
  838. end)
  839. end)(Weld)
  840. Part = Instance.new("Part")
  841. Part.Name = "Rear Right Bumper"
  842. Part.BrickColor = MasterColor
  843. Part.TopSurface = "Smooth"
  844. Part.BottomSurface = "Smooth"
  845. Part.FormFactor = "Custom"
  846. Part.Size = Vector3.new(2, 1, 2)
  847. Part.Parent = Vehicle
  848. Mesh = Instance.new("SpecialMesh")
  849. Mesh.MeshType = "Brick"
  850. Mesh.Scale = Vector3.new(1, 1, 0.95)
  851. Mesh.Parent = Part
  852. Weld = Instance.new("Weld")
  853. Weld.Parent = Part
  854. Weld.Part0 = Base
  855. Weld.Part1 = Part
  856. Weld.C0 = CFrame.new(5, 0, 10.55)
  857. Part = Instance.new("Part")
  858. Part.Name = "Rear Left Bumper"
  859. Part.BrickColor = MasterColor
  860. Part.TopSurface = "Smooth"
  861. Part.BottomSurface = "Smooth"
  862. Part.FormFactor = "Custom"
  863. Part.Size = Vector3.new(2, 1, 2)
  864. Part.Parent = Vehicle
  865. Mesh = Instance.new("SpecialMesh")
  866. Mesh.MeshType = "Brick"
  867. Mesh.Scale = Vector3.new(1, 1, 0.95)
  868. Mesh.Parent = Part
  869. Weld = Instance.new("Weld")
  870. Weld.Parent = Part
  871. Weld.Part0 = Base
  872. Weld.Part1 = Part
  873. Weld.C0 = CFrame.new(-5, 0, 10.55)
  874. Part = Instance.new("Part")
  875. Part.Name = "Rear Center Bumper"
  876. Part.BrickColor = MasterColor
  877. Part.TopSurface = "Smooth"
  878. Part.BottomSurface = "Smooth"
  879. Part.FormFactor = "Custom"
  880. Part.Size = Vector3.new(8, 1, 3)
  881. Part.Parent = Vehicle
  882. Weld = Instance.new("Weld")
  883. Weld.Parent = Part
  884. Weld.Part0 = Base
  885. Weld.Part1 = Part
  886. Weld.C0 = CFrame.new(0, 0, 10)
  887. Part = Instance.new("Part")
  888. Part.Name = "Rear Left Roof Support"
  889. Part.BrickColor = MasterColor
  890. Part.TopSurface = "Smooth"
  891. Part.BottomSurface = "Smooth"
  892. Part.FormFactor = "Custom"
  893. Part.Size = Vector3.new(2, 3, 1)
  894. Part.Parent = Vehicle
  895. Weld = Instance.new("Weld")
  896. Weld.Parent = Part
  897. Weld.Part0 = Base
  898. Weld.Part1 = Part
  899. Weld.C0 = CFrame.new(-5, 4.729, 2.355)
  900. Part = Instance.new("Part")
  901. Part.Name = "Rear Right Roof Support"
  902. Part.BrickColor = MasterColor
  903. Part.TopSurface = "Smooth"
  904. Part.BottomSurface = "Smooth"
  905. Part.FormFactor = "Custom"
  906. Part.Size = Vector3.new(2, 4, 1)
  907. Part.Parent = Vehicle
  908. Weld = Instance.new("Weld")
  909. Weld.Parent = Part
  910. Weld.Part0 = Base
  911. Weld.Part1 = Part
  912. Weld.C0 = CFrame.new(5, 4.729, 2.355)
  913. Part = Instance.new("Part")
  914. Part.Name = "Rear Window"
  915. Part.BrickColor = BrickColor.new("Institutional white")
  916. Part.Transparency = 0.75
  917. Part.TopSurface = "Smooth"
  918. Part.BottomSurface = "Smooth"
  919. Part.FormFactor = "Custom"
  920. Part.Size = Vector3.new(8, 3, 1)
  921. Part.Parent = Vehicle
  922. Weld = Instance.new("Weld")
  923. Weld.Parent = Part
  924. Weld.Part0 = Base
  925. Weld.Part1 = Part
  926. Weld.C0 = CFrame.new(0, 4.729, 2.355)
  927. Part = Instance.new("Part")
  928. Part.Name = "Center"
  929. Part.BrickColor = MasterColor
  930. Part.TopSurface = "Smooth"
  931. Part.BottomSurface = "Smooth"
  932. Part.FormFactor = "Custom"
  933. Part.Size = Vector3.new(12, 3.25, 1)
  934. Part.Parent = Vehicle
  935. Weld = Instance.new("Weld")
  936. Weld.Parent = Part
  937. Weld.Part0 = Base
  938. Weld.Part1 = Part
  939. Weld.C0 = CFrame.new(0, 1.625, 2.355)
  940. Part = Instance.new("Part")
  941. Part.Name = "Left Rear Wall"
  942. Part.BrickColor = MasterColor
  943. Part.TopSurface = "Smooth"
  944. Part.BottomSurface = "Smooth"
  945. Part.FormFactor = "Custom"
  946. Part.Size = Vector3.new(1, 4, 4)
  947. Part.Parent = Vehicle
  948. Weld = Instance.new("Weld")
  949. Weld.Parent = Part
  950. Weld.Part0 = Base
  951. Weld.Part1 = Part
  952. Weld.C0 = CFrame.new(-5.5, 2, 4.5)
  953. Part = Instance.new("Part")
  954. Part.Name = "Right Rear Wall"
  955. Part.BrickColor = MasterColor
  956. Part.TopSurface = "Smooth"
  957. Part.BottomSurface = "Smooth"
  958. Part.FormFactor = "Custom"
  959. Part.Size = Vector3.new(1, 4, 4)
  960. Part.Parent = Vehicle
  961. Weld = Instance.new("Weld")
  962. Weld.Parent = Part
  963. Weld.Part0 = Base
  964. Weld.Part1 = Part
  965. Weld.C0 = CFrame.new(5.5, 2, 4.5)
  966. Part = Instance.new("Part")
  967. Part.Name = "Rear Left Well 1"
  968. Part.BrickColor = MasterColor
  969. Part.TopSurface = "Smooth"
  970. Part.BottomSurface = "Smooth"
  971. Part.FormFactor = "Custom"
  972. Part.Size = Vector3.new(1, 2, 3)
  973. Part.Parent = Vehicle
  974. Mesh = Instance.new("SpecialMesh")
  975. Mesh.MeshType = "Brick"
  976. Mesh.Scale = Vector3.new(1, 1.25, 1)
  977. Mesh.Parent = Part
  978. Weld = Instance.new("Weld")
  979. Weld.Parent = Part
  980. Weld.Part0 = Base
  981. Weld.Part1 = Part
  982. Weld.C0 = CFrame.new(-5.5, 2.75, 8)
  983. Part = Instance.new("Part")
  984. Part.Name = "Rear Left Well 2"
  985. Part.BrickColor = MasterColor
  986. Part.TopSurface = "Smooth"
  987. Part.BottomSurface = "Smooth"
  988. Part.FormFactor = "Custom"
  989. Part.Size = Vector3.new(1, 4, 2)
  990. Part.Parent = Vehicle
  991. Mesh = Instance.new("SpecialMesh")
  992. Mesh.MeshType = "Brick"
  993. Mesh.Scale = Vector3.new(1, 0.875, 1)
  994. Mesh.Parent = Part
  995. Weld = Instance.new("Weld")
  996. Weld.Parent = Part
  997. Weld.Part0 = Base
  998. Weld.Part1 = Part
  999. Weld.C0 = CFrame.new(-5.5, 2.25, 10.5)
  1000. Part = Instance.new("Part")
  1001. Part.Name = "Rear Right Well 1"
  1002. Part.BrickColor = MasterColor
  1003. Part.TopSurface = "Smooth"
  1004. Part.BottomSurface = "Smooth"
  1005. Part.FormFactor = "Custom"
  1006. Part.Size = Vector3.new(1, 2, 3)
  1007. Part.Parent = Vehicle
  1008. Mesh = Instance.new("SpecialMesh")
  1009. Mesh.MeshType = "Brick"
  1010. Mesh.Scale = Vector3.new(1, 1.25, 1)
  1011. Mesh.Parent = Part
  1012. Weld = Instance.new("Weld")
  1013. Weld.Parent = Part
  1014. Weld.Part0 = Base
  1015. Weld.Part1 = Part
  1016. Weld.C0 = CFrame.new(5.5, 2.75, 8)
  1017. Part = Instance.new("Part")
  1018. Part.Name = "Rear Right Well 2"
  1019. Part.BrickColor = MasterColor
  1020. Part.TopSurface = "Smooth"
  1021. Part.BottomSurface = "Smooth"
  1022. Part.FormFactor = "Custom"
  1023. Part.Size = Vector3.new(1, 4, 2)
  1024. Part.Parent = Vehicle
  1025. Mesh = Instance.new("SpecialMesh")
  1026. Mesh.MeshType = "Brick"
  1027. Mesh.Scale = Vector3.new(1, 0.875, 1)
  1028. Mesh.Parent = Part
  1029. Weld = Instance.new("Weld")
  1030. Weld.Parent = Part
  1031. Weld.Part0 = Base
  1032. Weld.Part1 = Part
  1033. Weld.C0 = CFrame.new(5.5, 2.25, 10.5)
  1034. Part = Instance.new("WedgePart")
  1035. Part.Name = "Rear Left Well 3"
  1036. Part.BrickColor = MasterColor
  1037. Part.TopSurface = "Smooth"
  1038. Part.BottomSurface = "Smooth"
  1039. Part.FormFactor = "Custom"
  1040. Part.Size = Vector3.new(1, 1, 1)
  1041. Part.Parent = Vehicle
  1042. Mesh = Instance.new("SpecialMesh")
  1043. Mesh.MeshType = "Wedge"
  1044. Mesh.Scale = Vector3.new(1, 0.5, 0.5)
  1045. Mesh.Parent = Part
  1046. Weld = Instance.new("Weld")
  1047. Weld.Parent = Part
  1048. Weld.Part0 = Base
  1049. Weld.Part1 = Part
  1050. Weld.C0 = CFrame.new(-5.5, 1.25, 6.75) * CFrame.fromEulerAnglesXYZ(math.rad(180), 0, 0)
  1051. Part = Instance.new("WedgePart")
  1052. Part.Name = "Rear Right Well 3"
  1053. Part.BrickColor = MasterColor
  1054. Part.TopSurface = "Smooth"
  1055. Part.BottomSurface = "Smooth"
  1056. Part.FormFactor = "Custom"
  1057. Part.Size = Vector3.new(1, 1, 1)
  1058. Part.Parent = Vehicle
  1059. Mesh = Instance.new("SpecialMesh")
  1060. Mesh.MeshType = "Wedge"
  1061. Mesh.Scale = Vector3.new(1, 0.5, 0.5)
  1062. Mesh.Parent = Part
  1063. Weld = Instance.new("Weld")
  1064. Weld.Parent = Part
  1065. Weld.Part0 = Base
  1066. Weld.Part1 = Part
  1067. Weld.C0 = CFrame.new(5.5, 1.25, 6.75) * CFrame.fromEulerAnglesXYZ(math.rad(180), 0, 0)
  1068. Part = Instance.new("WedgePart")
  1069. Part.Name = "Rear Left Well 4"
  1070. Part.BrickColor = MasterColor
  1071. Part.TopSurface = "Smooth"
  1072. Part.BottomSurface = "Smooth"
  1073. Part.FormFactor = "Custom"
  1074. Part.Size = Vector3.new(1, 1, 1)
  1075. Part.Parent = Vehicle
  1076. Mesh = Instance.new("SpecialMesh")
  1077. Mesh.MeshType = "Wedge"
  1078. Mesh.Scale = Vector3.new(1, 0.5, 0.5)
  1079. Mesh.Parent = Part
  1080. Weld = Instance.new("Weld")
  1081. Weld.Parent = Part
  1082. Weld.Part0 = Base
  1083. Weld.Part1 = Part
  1084. Weld.C0 = CFrame.new(-5.5, 1.25, 9.25) * CFrame.fromEulerAnglesXYZ(math.rad(180), math.rad(180), 0)
  1085. Part = Instance.new("WedgePart")
  1086. Part.Name = "Rear Right Well 4"
  1087. Part.BrickColor = MasterColor
  1088. Part.TopSurface = "Smooth"
  1089. Part.BottomSurface = "Smooth"
  1090. Part.FormFactor = "Custom"
  1091. Part.Size = Vector3.new(1, 1, 1)
  1092. Part.Parent = Vehicle
  1093. Mesh = Instance.new("SpecialMesh")
  1094. Mesh.MeshType = "Wedge"
  1095. Mesh.Scale = Vector3.new(1, 0.5, 0.5)
  1096. Mesh.Parent = Part
  1097. Weld = Instance.new("Weld")
  1098. Weld.Parent = Part
  1099. Weld.Part0 = Base
  1100. Weld.Part1 = Part
  1101. Weld.C0 = CFrame.new(5.5, 1.25, 9.25) * CFrame.fromEulerAnglesXYZ(math.rad(180), math.rad(180), 0)
  1102. Part = Instance.new("Part")
  1103. Part.Name = "Rear Left Well 5"
  1104. Part.BrickColor = MasterColor
  1105. Part.TopSurface = "Smooth"
  1106. Part.BottomSurface = "Smooth"
  1107. Part.FormFactor = "Custom"
  1108. Part.Size = Vector3.new(1, 1, 3)
  1109. Part.Parent = Vehicle
  1110. Mesh = Instance.new("SpecialMesh")
  1111. Mesh.MeshType = "Brick"
  1112. Mesh.Scale = Vector3.new(1.01, 1.01, 1.2)
  1113. Mesh.Parent = Part
  1114. Weld = Instance.new("Weld")
  1115. Weld.Parent = Part
  1116. Weld.Part0 = Base
  1117. Weld.Part1 = Part
  1118. Weld.C0 = CFrame.new(-4.5, 1, 8)
  1119. Part = Instance.new("Part")
  1120. Part.Name = "Rear Right Well 5"
  1121. Part.BrickColor = MasterColor
  1122. Part.TopSurface = "Smooth"
  1123. Part.BottomSurface = "Smooth"
  1124. Part.FormFactor = "Custom"
  1125. Part.Size = Vector3.new(1, 1, 3)
  1126. Part.Parent = Vehicle
  1127. Mesh = Instance.new("SpecialMesh")
  1128. Mesh.MeshType = "Brick"
  1129. Mesh.Scale = Vector3.new(1.01, 1.01, 1.2)
  1130. Mesh.Parent = Part
  1131. Weld = Instance.new("Weld")
  1132. Weld.Parent = Part
  1133. Weld.Part0 = Base
  1134. Weld.Part1 = Part
  1135. Weld.C0 = CFrame.new(4.5, 1, 8)
  1136. Part = Instance.new("Part")
  1137. Part.Name = "Trunk"
  1138. Part.BrickColor = MasterColor
  1139. Part.TopSurface = "Smooth"
  1140. Part.BottomSurface = "Smooth"
  1141. Part.FormFactor = "Custom"
  1142. Part.Size = Vector3.new(10, 4, 1)
  1143. Part.Parent = Vehicle
  1144. Mesh = Instance.new("SpecialMesh")
  1145. Mesh.MeshType = "Brick"
  1146. Mesh.Scale = Vector3.new(1, 0.875, 0.5)
  1147. Mesh.Parent = Part
  1148. Weld = Instance.new("Weld")
  1149. Weld.Parent = Part
  1150. Weld.Part0 = Base
  1151. Weld.Part1 = Part
  1152. Weld.C0 = CFrame.new(0, 0.5, 11)
  1153. Weld.C1 = CFrame.new(0, -1.75, -0.25)
  1154. local Open = Instance.new("ClickDetector")
  1155. Open.Parent = Part
  1156. coroutine.wrap(function(Weld2)
  1157. local IsOpen = false
  1158. local CanOpen = true
  1159. Open.MouseClick:connect(function()
  1160. if IsOpen == false and CanOpen == true then
  1161. CanOpen = false
  1162. IsOpen = true
  1163. for i = 0, 1, 0.05 do
  1164. Weld2.C1 = CFrame.new(Weld2.C1.p) * CFrame.fromEulerAnglesXYZ(math.rad(-90 * i), 0, 0)
  1165. wait()
  1166. end
  1167. Weld2.C1 = CFrame.new(Weld2.C1.p) * CFrame.fromEulerAnglesXYZ(math.rad(-90), 0, 0)
  1168. CanOpen = true
  1169. elseif IsOpen == true and CanOpen == true then
  1170. CanOpen = false
  1171. IsOpen = false
  1172. for i = 1, 0, -0.05 do
  1173. Weld2.C1 = CFrame.new(Weld2.C1.p) * CFrame.fromEulerAnglesXYZ(math.rad(-90 * i), 0, 0)
  1174. wait()
  1175. end
  1176. Weld2.C1 = CFrame.new(Weld2.C1.p)
  1177. CanOpen = true
  1178. end
  1179. end)
  1180. end)(Weld)
  1181. Part = Instance.new("Part")
  1182. Part.Name = "Left Brake Light"
  1183. Part.TopSurface = "Smooth"
  1184. Part.BottomSurface = "Smooth"
  1185. Part.FormFactor = "Custom"
  1186. Part.Size = Vector3.new(2, 1, 1)
  1187. Part.Parent = Vehicle
  1188. Mesh = Instance.new("SpecialMesh")
  1189. Mesh.MeshType = "Brick"
  1190. Mesh.Scale = Vector3.new(1, 1, 0.01)
  1191. Mesh.Parent = Part
  1192. Weld = Instance.new("Weld")
  1193. Weld.Parent = Part
  1194. Weld.Part0 = Vehicle.Trunk
  1195. Weld.Part1 = Part
  1196. Weld.C0 = CFrame.new(-4, 0.25, 0.25)
  1197. coroutine.wrap(function(Part2)
  1198. while true do
  1199. if Part2:FindFirstChild("Weld") == nil or IsBraking == false then
  1200. Part2.Transparency = 0.75
  1201. Part2.BrickColor = BrickColor.new("Dark red")
  1202. else
  1203. Part2.Transparency = 0
  1204. Part2.BrickColor = BrickColor.new("Really red")
  1205. end
  1206. wait()
  1207. end
  1208. end)(Part)
  1209. Part = Instance.new("Part")
  1210. Part.Name = "Left Rear Turn Signal"
  1211. Part.BrickColor = BrickColor.new("New Yeller")
  1212. Part.TopSurface = "Smooth"
  1213. Part.BottomSurface = "Smooth"
  1214. Part.FormFactor = "Custom"
  1215. Part.Size = Vector3.new(1, 1, 1)
  1216. Part.Parent = Vehicle
  1217. Mesh = Instance.new("SpecialMesh")
  1218. Mesh.MeshType = "Brick"
  1219. Mesh.Scale = Vector3.new(0.5, 1.5, 0.01)
  1220. Mesh.Parent = Part
  1221. Weld = Instance.new("Weld")
  1222. Weld.Parent = Part
  1223. Weld.Part0 = Base
  1224. Weld.Part1 = Part
  1225. Weld.C0 = CFrame.new(-5.25, 2.25, 11.5)
  1226. Part = Instance.new("Part")
  1227. Part.Name = "Right Brake Light"
  1228. Part.TopSurface = "Smooth"
  1229. Part.BottomSurface = "Smooth"
  1230. Part.FormFactor = "Custom"
  1231. Part.Size = Vector3.new(2, 1, 1)
  1232. Part.Parent = Vehicle
  1233. Mesh = Instance.new("SpecialMesh")
  1234. Mesh.MeshType = "Brick"
  1235. Mesh.Scale = Vector3.new(1, 1, 0.01)
  1236. Mesh.Parent = Part
  1237. Weld = Instance.new("Weld")
  1238. Weld.Parent = Part
  1239. Weld.Part0 = Vehicle.Trunk
  1240. Weld.Part1 = Part
  1241. Weld.C0 = CFrame.new(4, 0.25, 0.25)
  1242. coroutine.wrap(function(Part2)
  1243. while true do
  1244. if Part2:FindFirstChild("Weld") == nil or IsBraking == false then
  1245. Part2.Transparency = 0.75
  1246. Part2.BrickColor = BrickColor.new("Dark red")
  1247. else
  1248. Part2.Transparency = 0
  1249. Part2.BrickColor = BrickColor.new("Really red")
  1250. end
  1251. wait()
  1252. end
  1253. end)(Part)
  1254. Part = Instance.new("Part")
  1255. Part.Name = "Right Rear Turn Signal"
  1256. Part.BrickColor = BrickColor.new("New Yeller")
  1257. Part.TopSurface = "Smooth"
  1258. Part.BottomSurface = "Smooth"
  1259. Part.FormFactor = "Custom"
  1260. Part.Size = Vector3.new(1, 1, 1)
  1261. Part.Parent = Vehicle
  1262. Mesh = Instance.new("SpecialMesh")
  1263. Mesh.MeshType = "Brick"
  1264. Mesh.Scale = Vector3.new(0.5, 1.5, 0.01)
  1265. Mesh.Parent = Part
  1266. Weld = Instance.new("Weld")
  1267. Weld.Parent = Part
  1268. Weld.Part0 = Base
  1269. Weld.Part1 = Part
  1270. Weld.C0 = CFrame.new(5.25, 2.25, 11.5)
  1271. Part = Instance.new("Part")
  1272. Part.Name = "Left Reverse Light"
  1273. Part.TopSurface = "Smooth"
  1274. Part.BottomSurface = "Smooth"
  1275. Part.FormFactor = "Custom"
  1276. Part.Size = Vector3.new(2, 1, 1)
  1277. Part.Parent = Vehicle
  1278. Mesh = Instance.new("SpecialMesh")
  1279. Mesh.MeshType = "Brick"
  1280. Mesh.Scale = Vector3.new(1, 0.5, 0.01)
  1281. Mesh.Parent = Part
  1282. Weld = Instance.new("Weld")
  1283. Weld.Parent = Part
  1284. Weld.Part0 = Vehicle.Trunk
  1285. Weld.Part1 = Part
  1286. Weld.C0 = CFrame.new(-4, -0.5, 0.25)
  1287. coroutine.wrap(function(Part2)
  1288. wait()
  1289. while true do
  1290. if Part2:FindFirstChild("Weld") == nil or ThrottlePercent >= 0 then
  1291. Part2.Transparency = 0.5
  1292. Part2.BrickColor = BrickColor.new("White")
  1293. else
  1294. Part2.Transparency = 0
  1295. Part2.BrickColor = BrickColor.new("Institutional white")
  1296. end
  1297. wait()
  1298. end
  1299. end)(Part)
  1300. Part = Instance.new("Part")
  1301. Part.Name = "Right Reverse Light"
  1302. Part.TopSurface = "Smooth"
  1303. Part.BottomSurface = "Smooth"
  1304. Part.FormFactor = "Custom"
  1305. Part.Size = Vector3.new(2, 1, 1)
  1306. Part.Parent = Vehicle
  1307. Mesh = Instance.new("SpecialMesh")
  1308. Mesh.MeshType = "Brick"
  1309. Mesh.Scale = Vector3.new(1, 0.5, 0.01)
  1310. Mesh.Parent = Part
  1311. Weld = Instance.new("Weld")
  1312. Weld.Parent = Part
  1313. Weld.Part0 = Vehicle.Trunk
  1314. Weld.Part1 = Part
  1315. Weld.C0 = CFrame.new(4, -0.5, 0.25)
  1316. coroutine.wrap(function(Part2)
  1317. wait()
  1318. while true do
  1319. if Part2:FindFirstChild("Weld") == nil or ThrottlePercent >= 0 then
  1320. Part2.Transparency = 0.5
  1321. Part2.BrickColor = BrickColor.new("White")
  1322. else
  1323. Part2.Transparency = 0
  1324. Part2.BrickColor = BrickColor.new("Institutional white")
  1325. end
  1326. wait()
  1327. end
  1328. end)(Part)
  1329. Part = Instance.new("Part")
  1330. Part.Name = "Rear Right Wheel"
  1331. Part.BrickColor = BrickColor.new("Really black")
  1332. Part.TopSurface = "Smooth"
  1333. Part.BottomSurface = "Smooth"
  1334. Part.FormFactor = "Custom"
  1335. Part.Size = Vector3.new(3, 2, 3)
  1336. Part.Friction = TireFriction
  1337. Part.Elasticity = TireElasticity
  1338. Part.Parent = Vehicle
  1339. Mesh = Instance.new("CylinderMesh")
  1340. Mesh.Parent = Part
  1341. Weld = Instance.new("Weld")
  1342. Weld.Parent = Part
  1343. Weld.Part0 = Base
  1344. Weld.Part1 = Part
  1345. Weld.C0 = CFrame.new(5, 0, 8) * CFrame.fromEulerAnglesXYZ(0, 0, math.rad(90))
  1346. Part = Instance.new("Part")
  1347. Part.Name = "Rear Left Wheel"
  1348. Part.BrickColor = BrickColor.new("Really black")
  1349. Part.TopSurface = "Smooth"
  1350. Part.BottomSurface = "Smooth"
  1351. Part.FormFactor = "Custom"
  1352. Part.Size = Vector3.new(3, 2, 3)
  1353. Part.Friction = TireFriction
  1354. Part.Elasticity = TireElasticity
  1355. Part.Parent = Vehicle
  1356. Mesh = Instance.new("CylinderMesh")
  1357. Mesh.Parent = Part
  1358. Weld = Instance.new("Weld")
  1359. Weld.Parent = Part
  1360. Weld.Part0 = Base
  1361. Weld.Part1 = Part
  1362. Weld.C0 = CFrame.new(-5, 0, 8) * CFrame.fromEulerAnglesXYZ(0, 0, math.rad(90))
  1363. Part = Instance.new("Part")
  1364. Part.Name = "Front Right Wheel"
  1365. Part.BrickColor = BrickColor.new("Really black")
  1366. Part.TopSurface = "Smooth"
  1367. Part.BottomSurface = "Smooth"
  1368. Part.FormFactor = "Custom"
  1369. Part.Size = Vector3.new(3, 2, 3)
  1370. Part.Friction = TireFriction
  1371. Part.Elasticity = TireElasticity
  1372. Part.Parent = Vehicle
  1373. Mesh = Instance.new("CylinderMesh")
  1374. Mesh.Parent = Part
  1375. Weld = Instance.new("Weld")
  1376. Weld.Parent = Part
  1377. Weld.Part0 = Base
  1378. Weld.Part1 = Part
  1379. Weld.C0 = CFrame.new(5, 0, -4) * CFrame.fromEulerAnglesXYZ(0, 0, math.rad(90))
  1380. Part = Instance.new("Part")
  1381. Part.Name = "Front Left Wheel"
  1382. Part.BrickColor = BrickColor.new("Really black")
  1383. Part.TopSurface = "Smooth"
  1384. Part.BottomSurface = "Smooth"
  1385. Part.FormFactor = "Custom"
  1386. Part.Size = Vector3.new(3, 2, 3)
  1387. Part.Friction = TireFriction
  1388. Part.Elasticity = TireElasticity
  1389. Part.Parent = Vehicle
  1390. Mesh = Instance.new("CylinderMesh")
  1391. Mesh.Parent = Part
  1392. Weld = Instance.new("Weld")
  1393. Weld.Parent = Part
  1394. Weld.Part0 = Base
  1395. Weld.Part1 = Part
  1396. Weld.C0 = CFrame.new(-5, 0, -4) * CFrame.fromEulerAnglesXYZ(0, 0, math.rad(90))
  1397. Vehicle:MoveTo((Workspace:FindFirstChild("adamfontenot") == nil and Vector3.new() or Workspace.adamfontenot.Torso.Position) + Vector3.new(9, 3, 0))
  1398. --[[
  1399. Vehicle Support v8
  1400. Variables:
  1401. Health
  1402. MaxHealth
  1403. ToughnessMinorDamage
  1404. ToughnessMajorDamage
  1405. DriftAcceleration
  1406. DriftSteerDifficulty
  1407. DriftSteerPower
  1408. Acceleration
  1409. TopSpeed
  1410. Deceleration
  1411. BrakePower
  1412. SteerDifficulty
  1413. SteerPower
  1414. TireFriction
  1415. TireElasticity
  1416. MasterColor
  1417. Wrecked
  1418. Vehicle (Model)
  1419. Base (Part)
  1420. Thrust (BodyVelocity)
  1421. Steer (BodyGyro)
  1422. Seat (VehicleSeat)
  1423. --]]
  1424. Wheels = {}
  1425. RearTraction = false
  1426. FrontTraction = false
  1427. DriftCheck = 0
  1428. Drifting = false
  1429. ThrottlePercent = 0
  1430. IsBraking = false
  1431. SteerPercent = 0
  1432. if Wrecked == true then Health = math.random(1, MaxHealth) end
  1433. for _, Part in pairs(Vehicle:GetChildren()) do
  1434. if Part:IsA("BasePart") then
  1435. Part.Locked = true
  1436. if Wrecked == true then
  1437. pcall(function() Part.Weld.C1 = Part.Weld.C1 * CFrame.fromEulerAnglesXYZ(math.rad(math.random(-7.5, 7.5)), math.rad(math.random(-7.5, 7.5)), math.rad(math.random(-7.5, 7.5))) end)
  1438. if math.random(1, 5) == 1 then Part.Material = "CorrodedMetal" end
  1439. if math.random(1, 10) == 1 then Part.BrickColor = BrickColor.new("Black") end
  1440. if math.random(1, 50) == 1 then Part.BrickColor = BrickColor.new("Really black") end
  1441. end
  1442. if string.match(Part.Name, "VehicleSeat") == nil and string.match(Part.Name, "VehicleEngine") == nil and string.match(Part.Name, "VehicleBase") == nil and string.match(Part.Name, " Wheel") == nil then
  1443. Part.Touched:connect(function(Hit)
  1444. if Hit.Parent == nil then return end
  1445. if Hit.Parent == Vehicle then return end
  1446. if Hit.CanCollide == false then return end
  1447. if Part:FindFirstChild("Weld") == nil then return end
  1448. if string.match(Hit.Name, "VehicleSeat") or string.match(Hit.Name, "VehicleEngine") or string.match(Hit.Name, "VehicleBase") then return end
  1449. local velocity1 = {
  1450. math.abs(Part.Velocity.x),
  1451. math.abs(Part.Velocity.y),
  1452. math.abs(Part.Velocity.z)
  1453. }
  1454. local rotvelocity1 = {
  1455. math.abs(Part.RotVelocity.x),
  1456. math.abs(Part.RotVelocity.y),
  1457. math.abs(Part.RotVelocity.z)
  1458. }
  1459. local velocity2 = {
  1460. math.abs(Hit.Velocity.x),
  1461. math.abs(Hit.Velocity.y),
  1462. math.abs(Hit.Velocity.z)
  1463. }
  1464. local rotvelocity2 = {
  1465. math.abs(Hit.RotVelocity.x),
  1466. math.abs(Hit.RotVelocity.y),
  1467. math.abs(Hit.RotVelocity.z)
  1468. }
  1469. for i = 1, #velocity1 do
  1470. local Total = math.abs(velocity1[i] - velocity2[i])
  1471. if Total > ToughnessMinorDamage / 2 then
  1472. Health = Health - (Total / 10)
  1473. end
  1474. if Total > ToughnessMinorDamage then
  1475. ThrottlePercent = ThrottlePercent * 0.9
  1476. pcall(function() Part.Weld.C0 = Part.Weld.C0 * CFrame.fromEulerAnglesXYZ(math.rad(math.random(-Total / 10, Total / 10)), math.rad(math.random(-Total / 10, Total / 10)), math.rad(math.random(-Total / 10, Total / 10))) end)
  1477. pcall(function() Part.Weld.C1 = Part.Weld.C1 * CFrame.fromEulerAnglesXYZ(math.rad(math.random(-Total / 10, Total / 10)), math.rad(math.random(-Total / 10, Total / 10)), math.rad(math.random(-Total / 10, Total / 10))) end)
  1478. end
  1479. if Total > ToughnessMajorDamage and Hit:GetMass() > 3 then
  1480. ThrottlePercent = 0
  1481. Part:BreakJoints()
  1482. Part.Velocity = Part.Velocity + math.random(math.random(-Total / 10, Total / 10), math.random(-Total / 10, Total / 10), math.random(-Total / 10, Total / 10))
  1483. Part.RotVelocity = Part.RotVelocity + math.random(math.random(-Total / 25, Total / 25), math.random(-Total / 25, Total / 25), math.random(-Total / 25, Total / 25))
  1484. end
  1485. if Total > math.random(50, 75) then
  1486. if Hit.Parent:FindFirstChild("Humanoid") ~= nil then
  1487. local Tag = Instance.new("ObjectValue", Hit.Parent.Humanoid)
  1488. Tag.Name = "creator"
  1489. Tag.Value = Driver
  1490. coroutine.wrap(function() wait(1) Tag:Remove() end)()
  1491. end
  1492. Hit:BreakJoints()
  1493. end
  1494. end
  1495. for i = 1, #rotvelocity1 do
  1496. local Total = math.abs(velocity1[i] - velocity2[i])
  1497. if Total > ToughnessMinorDamage / 4 and not string.match(Part.Name, " Wheel") then
  1498. Health = Health - (Total / 10)
  1499. end
  1500. if Total > ToughnessMinorDamage / 2 and not string.match(Part.Name, " Wheel") then
  1501. ThrottlePercent = ThrottlePercent * 0.9
  1502. pcall(function() Part.Weld.C0 = Part.Weld.C0 * CFrame.fromEulerAnglesXYZ(math.rad(math.random(-Total / 10, Total / 10)), math.rad(math.random(-Total / 10, Total / 10)), math.rad(math.random(-Total / 10, Total / 10))) end)
  1503. pcall(function() Part.Weld.C1 = Part.Weld.C1 * CFrame.fromEulerAnglesXYZ(math.rad(math.random(-Total / 10, Total / 10)), math.rad(math.random(-Total / 10, Total / 10)), math.rad(math.random(-Total / 10, Total / 10))) end)
  1504. end
  1505. if Total > ToughnessMajorDamage / 2 and Hit:GetMass() > 3 then
  1506. ThrottlePercent = ThrottlePercent * 0.75
  1507. Part:BreakJoints()
  1508. Part.Velocity = Part.Velocity + Vector3.new(math.random(-Total / 10, Total / 10), math.random(-Total / 10, Total / 10), math.random(-Total / 10, Total / 10))
  1509. Part.RotVelocity = Part.RotVelocity + Vector3.new(math.random(-Total / 25, Total / 25), math.random(-Total / 25, Total / 25), math.random(-Total / 25, Total / 25))
  1510. end
  1511. if Total > math.random(50, 75) then
  1512. if Hit.Parent:FindFirstChild("Humanoid") ~= nil then
  1513. local Tag = Instance.new("ObjectValue", Hit.Parent.Humanoid)
  1514. Tag.Name = "creator"
  1515. Tag.Value = Driver
  1516. coroutine.wrap(function() wait(1) Tag:Remove() end)()
  1517. end
  1518. Hit:BreakJoints()
  1519. end
  1520. end
  1521. end)
  1522. end
  1523. if string.match(Part.Name, " Wheel") then
  1524. table.insert(Wheels, Part)
  1525. end
  1526. Part.ChildRemoved:connect(function(Object)
  1527. if Object.Name == "Weld" then
  1528. Health = Health - 25
  1529. end
  1530. end)
  1531. end
  1532. end
  1533. while true do
  1534. RearTraction = false
  1535. FrontTraction = false
  1536. for _, Part in pairs(Wheels) do
  1537. local Hit = Workspace:FindPartOnRay(Ray.new(Part.Position, (Part.Position - (Part.CFrame * CFrame.fromEulerAnglesXYZ(0, 0, math.rad(90)) * CFrame.new(0, -1, 0)).p).unit * ((Part.Size.x / 2) + 0.5)), Vehicle)
  1538. if Hit ~= nil and Part:FindFirstChild("Weld") ~= nil then
  1539. if string.match(Part.Name, "Rear") then
  1540. RearTraction = true
  1541. else
  1542. FrontTraction = true
  1543. end
  1544. end
  1545. end
  1546. if Vehicle:FindFirstChild("VehicleEngine") ~= nil then
  1547. if Vehicle.VehicleEngine:FindFirstChild("Weld") == nil then
  1548. Health = 0
  1549. end
  1550. if pcall(function() return EffectHolder.Parent end) == false then
  1551. EffectHolder = Instance.new("Part")
  1552. EffectHolder.Name = ""
  1553. EffectHolder.CanCollide = false
  1554. EffectHolder.Anchored = true
  1555. EffectHolder.FormFactor = "Custom"
  1556. EffectHolder.Size = Vector3.new(1, 1, 1)
  1557. EffectHolder.TopSurface = 0
  1558. EffectHolder.BottomSurface = 0
  1559. EffectHolder.Transparency = 1
  1560. EffectHolder.Parent = Vehicle
  1561. end
  1562. EffectHolder.CFrame = CFrame.new(Vehicle.VehicleEngine.Position)
  1563. for _, Part in pairs(EffectHolder:GetChildren()) do
  1564. pcall(function() Part.Enabled = false end)
  1565. end
  1566. if Health <= 0 then
  1567. if EffectHolder:FindFirstChild("Smoke 0") == nil then
  1568. local Smoke = Instance.new("Smoke")
  1569. Smoke.Name = "Smoke 0"
  1570. Smoke.Color = Color3.new(0.05, 0.05, 0.05)
  1571. Smoke.RiseVelocity = 12.5
  1572. Smoke.Size = 12.5
  1573. Smoke.Parent = EffectHolder
  1574. end
  1575. if EffectHolder:FindFirstChild("Fire 0") == nil then
  1576. local Fire = Instance.new("Fire")
  1577. Fire.Name = "Fire 0"
  1578. Fire.Heat = 10
  1579. Fire.Size = 20
  1580. Fire.Parent = EffectHolder
  1581. end
  1582. EffectHolder["Smoke 0"].Enabled = true
  1583. EffectHolder["Fire 0"].Enabled = true
  1584. elseif Health < MaxHealth * 0.15 then
  1585. if EffectHolder:FindFirstChild("Smoke 1") == nil then
  1586. local Smoke = Instance.new("Smoke")
  1587. Smoke.Name = "Smoke 1"
  1588. Smoke.Color = Color3.new(0.25, 0.25, 0.25)
  1589. Smoke.RiseVelocity = 10
  1590. Smoke.Size = 10
  1591. Smoke.Parent = EffectHolder
  1592. end
  1593. if EffectHolder:FindFirstChild("Fire 1") == nil then
  1594. local Fire = Instance.new("Fire")
  1595. Fire.Name = "Fire 1"
  1596. Fire.Heat = 5
  1597. Fire.Size = 10
  1598. Fire.Parent = EffectHolder
  1599. end
  1600. EffectHolder["Smoke 1"].Enabled = true
  1601. EffectHolder["Fire 1"].Enabled = true
  1602. elseif Health < MaxHealth * 0.2 then
  1603. if EffectHolder:FindFirstChild("Smoke 2") == nil then
  1604. local Smoke = Instance.new("Smoke")
  1605. Smoke.Name = "Smoke 2"
  1606. Smoke.Color = Color3.new(0.5, 0.5, 0.5)
  1607. Smoke.RiseVelocity = 9
  1608. Smoke.Size = 7.5
  1609. Smoke.Parent = EffectHolder
  1610. end
  1611. EffectHolder["Smoke 2"].Enabled = true
  1612. elseif Health < MaxHealth * 0.3 then
  1613. if EffectHolder:FindFirstChild("Smoke 3") == nil then
  1614. local Smoke = Instance.new("Smoke")
  1615. Smoke.Name = "Smoke 3"
  1616. Smoke.Color = Color3.new(0.75, 0.75, 0.75)
  1617. Smoke.RiseVelocity = 7.5
  1618. Smoke.Size = 5
  1619. Smoke.Parent = EffectHolder
  1620. end
  1621. EffectHolder["Smoke 3"].Enabled = true
  1622. elseif Health < MaxHealth * 0.4 then
  1623. if EffectHolder:FindFirstChild("Smoke 4") == nil then
  1624. local Smoke = Instance.new("Smoke")
  1625. Smoke.Name = "Smoke 4"
  1626. Smoke.Color = Color3.new(1, 1, 1)
  1627. Smoke.RiseVelocity = 5
  1628. Smoke.Size = 3
  1629. Smoke.Parent = EffectHolder
  1630. end
  1631. EffectHolder["Smoke 4"].Enabled = true
  1632. end
  1633. else
  1634. Health = 0
  1635. if EffectHolder ~= nil then
  1636. EffectHolder:Remove()
  1637. EffectHolder = nil
  1638. end
  1639. end
  1640. if ThrottlePercent < 0.2 then
  1641. Drifting = false
  1642. DriftCheck = 0
  1643. end
  1644. if Seat.Throttle == 1 then
  1645. if ThrottlePercent > 0.2 and tick() - DriftCheck < 0.5 and Drifting == false then
  1646. coroutine.wrap(function()
  1647. DriftCheck = 0
  1648. Drifting = true
  1649. local OldAcceleration = Acceleration
  1650. local OldSteerDifficulty = SteerDifficulty
  1651. local OldSteerPower = SteerPower
  1652. Acceleration = DriftAcceleration
  1653. SteerDifficulty = DriftSteerDifficulty
  1654. SteerPower = DriftSteerPower
  1655. local EffectHolder1 = Instance.new("Part")
  1656. EffectHolder1.Name = ""
  1657. EffectHolder1.CanCollide = false
  1658. EffectHolder1.Anchored = true
  1659. EffectHolder1.FormFactor = "Custom"
  1660. EffectHolder1.Size = Vector3.new(1, 1, 1)
  1661. EffectHolder1.TopSurface = 0
  1662. EffectHolder1.BottomSurface = 0
  1663. EffectHolder1.Transparency = 1
  1664. EffectHolder1.Parent = Vehicle
  1665. local Smoke = Instance.new("Smoke")
  1666. Smoke.Color = Color3.new(0.9, 0.9, 0.9)
  1667. Smoke.RiseVelocity = 15
  1668. Smoke.Size = 10
  1669. Smoke.Parent = EffectHolder1
  1670. local EffectHolder2 = Instance.new("Part")
  1671. EffectHolder2.Name = ""
  1672. EffectHolder2.CanCollide = false
  1673. EffectHolder2.Anchored = true
  1674. EffectHolder2.FormFactor = "Custom"
  1675. EffectHolder2.Size = Vector3.new(1, 1, 1)
  1676. EffectHolder2.TopSurface = 0
  1677. EffectHolder2.BottomSurface = 0
  1678. EffectHolder2.Transparency = 1
  1679. EffectHolder2.Parent = Vehicle
  1680. local Smoke = Instance.new("Smoke")
  1681. Smoke.Color = Color3.new(0.9, 0.9, 0.9)
  1682. Smoke.RiseVelocity = 15
  1683. Smoke.Size = 10
  1684. Smoke.Parent = EffectHolder2
  1685. while Drifting == true do
  1686. if pcall(function() return Vehicle["Rear Left Wheel"].Weld end) == true then
  1687. EffectHolder1.CFrame = Vehicle["Rear Left Wheel"].CFrame * CFrame.fromEulerAnglesXYZ(math.rad(-90), 0, 0)
  1688. else
  1689. EffectHolder1.Smoke.Enabled = false
  1690. end
  1691. if pcall(function() return Vehicle["Rear Right Wheel"].Weld end) == true then
  1692. EffectHolder2.CFrame = Vehicle["Rear Right Wheel"].CFrame * CFrame.fromEulerAnglesXYZ(math.rad(-90), 0, 0)
  1693. else
  1694. EffectHolder2.Smoke.Enabled = false
  1695. end
  1696. wait()
  1697. end
  1698. Acceleration = OldAcceleration
  1699. SteerDifficulty = OldSteerDifficulty
  1700. SteerPower = OldSteerPower
  1701. EffectHolder1.Smoke.Enabled = false
  1702. EffectHolder2.Smoke.Enabled = false
  1703. wait(7.5)
  1704. EffectHolder1:Remove()
  1705. EffectHolder2:Remove()
  1706. end)()
  1707. coroutine.wrap(function()
  1708. while Drifting == true do
  1709. if pcall(function() return Vehicle["Rear Left Wheel"].Weld end) == true then
  1710. local DriftSound = Instance.new("Sound")
  1711. DriftSound.SoundId = "http://www.roblox.com/Asset/?id=31245495"
  1712. DriftSound.Volume = 1
  1713. DriftSound.Pitch = math.random(90, 120) / 100
  1714. DriftSound.Parent = Vehicle["Rear Left Wheel"]
  1715. DriftSound:Play()
  1716. end
  1717. wait(math.random(35, 60) / 100)
  1718. end
  1719. end)()
  1720. coroutine.wrap(function()
  1721. while Drifting == true do
  1722. if pcall(function() return Vehicle["Rear Right Wheel"].Weld end) == true then
  1723. local DriftSound = Instance.new("Sound")
  1724. DriftSound.SoundId = "http://www.roblox.com/Asset/?id=31245495"
  1725. DriftSound.Volume = 1
  1726. DriftSound.Pitch = math.random(90, 120) / 100
  1727. DriftSound.Parent = Vehicle["Rear Right Wheel"]
  1728. DriftSound:Play()
  1729. end
  1730. wait(math.random(35, 60) / 100)
  1731. end
  1732. end)()
  1733. coroutine.wrap(function()
  1734. while Drifting == true do
  1735. if pcall(function() return Vehicle["Rear Wheel"].Weld end) == true then
  1736. local DriftSound = Instance.new("Sound")
  1737. DriftSound.SoundId = "http://www.roblox.com/Asset/?id=31245495"
  1738. DriftSound.Volume = 1
  1739. DriftSound.Pitch = math.random(90, 120) / 100
  1740. DriftSound.Parent = Vehicle["Rear Wheel"]
  1741. DriftSound:Play()
  1742. end
  1743. wait(math.random(35, 60) / 100)
  1744. end
  1745. end)()
  1746. end
  1747. if ThrottlePercent < 0 then
  1748. ThrottlePercent = ThrottlePercent + BrakePower
  1749. IsBraking = true
  1750. else
  1751. ThrottlePercent = ThrottlePercent + Acceleration
  1752. IsBraking = false
  1753. end
  1754. elseif Seat.Throttle == -1 then
  1755. Drifting = false
  1756. if ThrottlePercent > 0.1 then
  1757. ThrottlePercent = ThrottlePercent - BrakePower
  1758. IsBraking = true
  1759. DriftCheck = tick()
  1760. else
  1761. ThrottlePercent = ThrottlePercent - Acceleration
  1762. end
  1763. else
  1764. if ThrottlePercent < 0 then
  1765. ThrottlePercent = ThrottlePercent + Deceleration
  1766. elseif ThrottlePercent > 0 then
  1767. ThrottlePercent = ThrottlePercent - Deceleration
  1768. end
  1769. if ThrottlePercent > -Deceleration * 1.1 and ThrottlePercent < Deceleration * 1.1 then
  1770. ThrottlePercent = 0
  1771. end
  1772. end
  1773. if ThrottlePercent > 1 then ThrottlePercent = 1 end
  1774. if ThrottlePercent < -1 then ThrottlePercent = -1 end
  1775. if ThrottlePercent ~= 0 and RearTraction == true and (pcall(function() return Vehicle["Rear Left Wheel"].Weld end) == true or pcall(function() return Vehicle["Rear Right Wheel"].Weld end) == true or pcall(function() return Vehicle["Rear Wheel"].Weld end) == true) and Health > 0 then
  1776. Thrust.maxForce = Vector3.new(math.huge, 0, math.huge)
  1777. Thrust.velocity = Base.CFrame.lookVector * (TopSpeed * ThrottlePercent)
  1778. else
  1779. Thrust.maxForce = Vector3.new()
  1780. end
  1781. if Seat.Steer == 1 then
  1782. SteerPercent = SteerPercent - (SteerDifficulty * (1 - (math.abs(ThrottlePercent) / 10)))
  1783. elseif Seat.Steer == -1 then
  1784. SteerPercent = SteerPercent + (SteerDifficulty * (1 - (math.abs(ThrottlePercent) / 10)))
  1785. else
  1786. if SteerPercent < 0 then
  1787. SteerPercent = SteerPercent + SteerDifficulty
  1788. elseif SteerPercent > 0 then
  1789. SteerPercent = SteerPercent - SteerDifficulty
  1790. end
  1791. if SteerPercent > -SteerDifficulty * 1.1 and SteerPercent < SteerDifficulty * 1.1 then
  1792. SteerPercent = 0
  1793. Drifting = false
  1794. end
  1795. end
  1796. if SteerPercent > 1 then SteerPercent = 1 end
  1797. if SteerPercent < -1 then SteerPercent = -1 end
  1798. if SteerPercent ~= 0 and RearTraction == true and FrontTraction == true and (pcall(function() return Vehicle["Rear Left Wheel"].Weld end) == true or pcall(function() return Vehicle["Rear Right Wheel"].Weld end) == true) and (pcall(function() return Vehicle["Front Left Wheel"].Weld end) == true or pcall(function() return Vehicle["Front Right Wheel"].Weld end) == true) and Health > 0 then
  1799. Steer.maxTorque = Vector3.new(0, math.huge, 0)
  1800. Steer.cframe = (Base.CFrame - Base.Position) * CFrame.fromEulerAnglesXYZ(0, math.rad((SteerPercent * SteerPower) * ((ThrottlePercent * 10) > 1 and 1 or (ThrottlePercent * 10))), 0)
  1801. ThrottlePercent = ThrottlePercent - ((Acceleration * 0.95) * (1 - math.abs(SteerPercent)))
  1802. ThrottlePercent = ThrottlePercent - (Acceleration * (SteerPercent / 2))
  1803. else
  1804. Steer.maxTorque = Vector3.new()
  1805. Steer.cframe = CFrame.new()
  1806. end
  1807. local SteerAngle = SteerPercent * (SteerPower * 1.5)
  1808. if SteerAngle > 80 then SteerAngle = 80 end
  1809. if SteerAngle < -80 then SteerAngle = -80 end
  1810. for _, Part in pairs(Wheels) do
  1811. if string.match(Part.Name, "Front ") then
  1812. pcall(function()
  1813. Part.Weld.C0 = CFrame.new(Part.Weld.C0.p) * CFrame.fromEulerAnglesXYZ(0, math.rad(SteerAngle), math.rad(90))
  1814. end)
  1815. end
  1816. end
  1817. if Seat:FindFirstChild("SeatWeld") ~= nil and Driver == nil then
  1818. local Part1 = Seat.SeatWeld.Part1
  1819. if Part1 ~= nil then
  1820. Driver = game:GetService("Players"):GetPlayerFromCharacter(Part1.Parent)
  1821. if Driver ~= nil then
  1822. local PlayerGui = Driver:FindFirstChild("PlayerGui")
  1823. if PlayerGui == nil then return end
  1824. local DriverGui = Instance.new("ScreenGui", PlayerGui)
  1825. DriverGui.Name = "DriverGui"
  1826. local Frame = Instance.new("Frame")
  1827. Frame.Name = "Content"
  1828. Frame.Size = UDim2.new(1, 0, 0, 100)
  1829. Frame.Position = UDim2.new(0, 0, 1, -100)
  1830. Frame.BorderSizePixel = 1
  1831. Frame.BorderColor3 = Color3.new(0, 0, 0)
  1832. Frame.BackgroundColor3 = Color3.new(0.15, 0.15, 0.15)
  1833. Frame.Parent = DriverGui
  1834. local TextLabel = Instance.new("TextLabel")
  1835. TextLabel.Name = "SpeedText1"
  1836. TextLabel.Size = UDim2.new(0, 85, 0, 15)
  1837. TextLabel.Position = UDim2.new(0, 15, 0, 7.5)
  1838. TextLabel.BorderSizePixel = 0
  1839. TextLabel.BackgroundTransparency = 1
  1840. TextLabel.TextColor3 = Color3.new(1, 1, 1)
  1841. TextLabel.Text = "Speed"
  1842. TextLabel.TextXAlignment = "Left"
  1843. TextLabel.FontSize = "Size12"
  1844. TextLabel.Parent = DriverGui.Content
  1845. local TextLabel = Instance.new("TextLabel")
  1846. TextLabel.Name = "SpeedText2"
  1847. TextLabel.Size = UDim2.new(0, 85, 0, 15)
  1848. TextLabel.Position = UDim2.new(0, 15, 0, 7.5 + 15)
  1849. TextLabel.BorderSizePixel = 0
  1850. TextLabel.BackgroundTransparency = 1
  1851. TextLabel.TextColor3 = Color3.new(1, 1, 1)
  1852. TextLabel.Text = "Bricks/sec."
  1853. TextLabel.TextXAlignment = "Left"
  1854. TextLabel.FontSize = "Size12"
  1855. TextLabel.Parent = DriverGui.Content
  1856. for i = 0, 1, 0.1 do
  1857. local TextLabel = Instance.new("TextLabel")
  1858. TextLabel.Name = "SpeedTextInc" ..i
  1859. TextLabel.Size = UDim2.new(0, 0, 0, 15)
  1860. TextLabel.Position = UDim2.new(0, 92 + (i * 200), 0, 37.5)
  1861. TextLabel.BorderSizePixel = 1
  1862. TextLabel.BackgroundTransparency = 0
  1863. TextLabel.TextColor3 = Color3.new(1, 1, 1)
  1864. TextLabel.Text = math.floor(TopSpeed * i)
  1865. TextLabel.TextXAlignment = "Left"
  1866. TextLabel.Parent = DriverGui.Content
  1867. end
  1868. local Frame = Instance.new("Frame")
  1869. Frame.Name = "SpeedBack"
  1870. Frame.Size = UDim2.new(0, 200, 0, 30)
  1871. Frame.Position = UDim2.new(0, 100, 0, 7.5)
  1872. Frame.BorderSizePixel = 1
  1873. Frame.BorderColor3 = Color3.new(0, 0, 0)
  1874. Frame.BackgroundColor3 = Color3.new(0, 0, 0)
  1875. Frame.Parent = DriverGui.Content
  1876. local Frame = Instance.new("Frame")
  1877. Frame.Name = "SpeedFront"
  1878. Frame.BorderSizePixel = 1
  1879. Frame.BorderColor3 = Color3.new(0, 0, 0)
  1880. Frame.BackgroundColor3 = Color3.new(0, 0, 0.9)
  1881. Frame.Parent = DriverGui.Content
  1882. coroutine.wrap(function()
  1883. while DriverGui.Parent ~= nil do
  1884. DriverGui.Content.SpeedFront.Size = DriverGui.Content.SpeedBack.Size - UDim2.new(0, DriverGui.Content.SpeedBack.Size.X.Offset * (1 - math.abs(ThrottlePercent)), 0, 0)
  1885. DriverGui.Content.SpeedFront.Position = DriverGui.Content.SpeedBack.Position
  1886. wait()
  1887. end
  1888. end)()
  1889. local TextLabel = Instance.new("TextLabel")
  1890. TextLabel.Name = "DamageText"
  1891. TextLabel.Size = UDim2.new(0, 85, 0, 30)
  1892. TextLabel.Position = UDim2.new(0, 215, 0, 57.5)
  1893. TextLabel.BorderSizePixel = 0
  1894. TextLabel.BackgroundTransparency = 1
  1895. TextLabel.TextColor3 = Color3.new(1, 1, 1)
  1896. TextLabel.Text = "Damage"
  1897. TextLabel.TextXAlignment = "Left"
  1898. TextLabel.FontSize = "Size12"
  1899. TextLabel.Parent = DriverGui.Content
  1900. local Frame = Instance.new("Frame")
  1901. Frame.Name = "DamageBack"
  1902. Frame.Size = UDim2.new(0, 250, 0, 30)
  1903. Frame.Position = UDim2.new(0, 300, 0, 57.5)
  1904. Frame.BorderSizePixel = 1
  1905. Frame.BorderColor3 = Color3.new(0, 0, 0)
  1906. Frame.BackgroundColor3 = Color3.new(0, 0.5, 0)
  1907. Frame.Parent = DriverGui.Content
  1908. local Frame = Instance.new("Frame")
  1909. Frame.Name = "DamageFront"
  1910. Frame.BorderSizePixel = 1
  1911. Frame.BorderColor3 = Color3.new(0, 0, 0)
  1912. Frame.BackgroundColor3 = Color3.new(0.9, 0, 0)
  1913. Frame.Parent = DriverGui.Content
  1914. coroutine.wrap(function()
  1915. local i = math.pi * 1.5
  1916. while DriverGui.Parent ~= nil do
  1917. DriverGui.Content.DamageFront.Size = DriverGui.Content.DamageBack.Size - UDim2.new(0, DriverGui.Content.DamageBack.Size.X.Offset * (1 - ((MaxHealth - Health) / MaxHealth)), 0, 0)
  1918. DriverGui.Content.DamageFront.Position = DriverGui.Content.DamageBack.Position
  1919. if Health < MaxHealth * 0.15 then
  1920. i = i + 0.4
  1921. elseif Health < MaxHealth * 0.2 then
  1922. i = i + 0.25
  1923. elseif Health < MaxHealth * 0.3 then
  1924. i = i + 0.1
  1925. elseif Health < MaxHealth * 0.4 then
  1926. i = i + 0.075
  1927. end
  1928. DriverGui.Content.DamageFront.BackgroundColor3 = Color3.new(1 - ((math.sin(i) + 1) / 2), 0, 0)
  1929. DriverGui.Content.DamageBack.BackgroundColor3 = Color3.new(0, 0.5 - (((math.sin(i) + 1) / 2) * 0.5), 0)
  1930. wait()
  1931. end
  1932. end)()
  1933. end
  1934. end
  1935. elseif Seat:FindFirstChild("SeatWeld") == nil and Driver ~= nil then
  1936. if Driver:FindFirstChild("PlayerGui") ~= nil then
  1937. if Driver.PlayerGui:FindFirstChild("DriverGui") ~= nil then
  1938. Driver.PlayerGui.DriverGui:Remove()
  1939. end
  1940. end
  1941. Driver = nil
  1942. end
  1943. if Health <= 0 then
  1944. Health = 0
  1945. ThrottlePercent = 0
  1946. if Vehicle:FindFirstChild("VehicleEngine") ~= nil then
  1947. if math.random(1, 1000) == 1 or Vehicle.VehicleEngine:FindFirstChild("Weld") == nil then
  1948. local Explosion = Instance.new("Explosion")
  1949. Explosion.BlastPressure = 5000 * ToughnessMajorDamage
  1950. Explosion.BlastRadius = ToughnessMajorDamage / 10
  1951. Explosion.Position = Vehicle.VehicleEngine.Position
  1952. Explosion.Parent = Workspace
  1953. Vehicle.VehicleEngine.Name = "Exploded VehicleEngine"
  1954. end
  1955. end
  1956. end
  1957. wait()
  1958. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement