Advertisement
TheUnknownDiscord

bus

Nov 26th, 2022
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.24 KB | None | 0 0
  1. local gas = 2000
  2. local PhysicsService = game:GetService("PhysicsService")
  3. local pards = {}
  4. local pards2 = {}
  5. local car = "car"
  6. local wheels = "wheels"
  7. pcall(function()
  8.  
  9. -- Create two collision groups
  10. PhysicsService:CreateCollisionGroup(car)
  11. PhysicsService:CreateCollisionGroup(wheels)
  12. PhysicsService:SetPartCollisionGroup(pards, car)
  13. PhysicsService:SetPartCollisionGroup(pards2, wheels)
  14.  
  15. PhysicsService:CollisionGroupSetCollidable(car, wheels, false)
  16. end)
  17. speed = 0
  18. local part = Instance.new("Part",script)
  19. part.Anchored = true
  20. part.CFrame = owner.Character.Head.CFrame
  21. part.Size = Vector3.new(10,0.1,28)
  22. local part2 = Instance.new("Part",script)
  23. part2.Anchored = true
  24. part2.CanCollide = false
  25. part2.CFrame = owner.Character.Head.CFrame
  26. local part3 = Instance.new("Part",script)
  27. part3.Anchored = true
  28. part3.CanCollide = false
  29. part3.CFrame = owner.Character.Head.CFrame
  30. local part4 = Instance.new("Part",script)
  31. part4.Anchored = true
  32. part4.CanCollide = false
  33. part4.CFrame = owner.Character.Head.CFrame
  34. local par = Instance.new("WedgePart",script)
  35. par.Anchored = true
  36. par.CFrame = owner.Character.Head.CFrame * CFrame.new(0,5,-15)
  37. par.Size = Vector3.new(10,6,2)
  38. local par2 = Instance.new("Part",script)
  39. par2.Anchored = true
  40. par2.CFrame = owner.Character.Head.CFrame * CFrame.new(-4.75,4,0)
  41. par2.Size = Vector3.new(1.5,8,28)
  42. local par3 = Instance.new("Part",script)
  43. par3.Anchored = true
  44. par3.CFrame = owner.Character.Head.CFrame * CFrame.new(4.75,4,5.5)
  45. par3.Size = Vector3.new(1.5,8,17)
  46. local par4 = Instance.new("Part",script)
  47. par4.Anchored = true
  48. par4.CFrame = owner.Character.Head.CFrame * CFrame.new(4.75,4,-10)
  49. par4.Size = Vector3.new(1.5,8,8)
  50. local par5 = Instance.new("Part",script)
  51. par5.Anchored = true
  52. par5.CFrame = owner.Character.Head.CFrame * CFrame.new(0,4,14)
  53. par5.Size = Vector3.new(10,8,1.5)
  54. local par6 = Instance.new("Part",script)
  55. par6.Anchored = true
  56. par6.CFrame = owner.Character.Head.CFrame * CFrame.new(-2.5,2.5,14.75)
  57. par6.Size = Vector3.new(1.5,4,1.5)
  58. local par7 = Instance.new("Part",script)
  59. par7.Anchored = true
  60. par7.CFrame = owner.Character.Head.CFrame * CFrame.new(0,8,0)
  61. par7.Size = Vector3.new(10,0.5,28)
  62. local par8 = Instance.new("WedgePart",script)
  63. par8.Anchored = true
  64. par8.CFrame = owner.Character.Head.CFrame * CFrame.new(0,0.5,-15)
  65. par8.Size = Vector3.new(10,3,2)
  66. par8.CFrame = par8.CFrame * CFrame.Angles(math.rad(180),math.rad(180),0)
  67. local par9 = Instance.new("Part",script)
  68. par9.Anchored = true
  69. par9.CFrame = owner.Character.Head.CFrame * CFrame.new(4.5,2.5,11.75)
  70. par9.Size = Vector3.new(0.1,0.75,0.75)
  71. par9.Shape = "Cylinder"
  72. par9.Material = "SmoothPlastic"
  73. par9.Color = Color3.fromRGB(50,50,50)
  74. local vseat = Instance.new("VehicleSeat",script)
  75. vseat.Anchored = true
  76. vseat.CFrame = owner.Character.Head.CFrame * CFrame.new(-2.5,1,-11)
  77. vseat.Size = Vector3.new(2.5,1.5,2)
  78. local seat = Instance.new("Seat",script)
  79. seat.Anchored = true
  80. seat.CFrame = owner.Character.Head.CFrame * CFrame.new(-2.5,1,0)
  81. seat.Size = Vector3.new(1.5,1.5,2)
  82. local seat2 = Instance.new("Seat",script)
  83. seat2.Anchored = true
  84. seat2.CFrame = owner.Character.Head.CFrame * CFrame.new(-2.5,1,4)
  85. seat2.Size = Vector3.new(1.5,1.5,2)
  86. local seat3 = Instance.new("Seat",script)
  87. seat3.Anchored = true
  88. seat3.CFrame = owner.Character.Head.CFrame * CFrame.new(-2.5,1,8)
  89. seat3.Size = Vector3.new(1.5,1.5,2)
  90. local seat4 = Instance.new("Seat",script)
  91. seat4.Anchored = true
  92. seat4.CFrame = owner.Character.Head.CFrame * CFrame.new(-2.5,1,12)
  93. seat4.Size = Vector3.new(1.5,1.5,2)
  94. local seat5 = Instance.new("Seat",script)
  95. seat5.Anchored = true
  96. seat5.CFrame = owner.Character.Head.CFrame * CFrame.new(2.5,1,0)
  97. seat5.Size = Vector3.new(1.5,1.5,2)
  98. local seat6 = Instance.new("Seat",script)
  99. seat6.Anchored = true
  100. seat6.CFrame = owner.Character.Head.CFrame * CFrame.new(2.5,1,4)
  101. seat6.Size = Vector3.new(1.5,1.5,2)
  102. local seat7 = Instance.new("Seat",script)
  103. seat7.Anchored = true
  104. seat7.CFrame = owner.Character.Head.CFrame * CFrame.new(2.5,1,8)
  105. seat7.Size = Vector3.new(1.5,1.5,2)
  106. local seat8 = Instance.new("Seat",script)
  107. seat8.Anchored = true
  108. seat8.CFrame = owner.Character.Head.CFrame * CFrame.new(2.5,1,12)
  109. seat8.Size = Vector3.new(1.5,1.5,2)
  110. local seat9 = Instance.new("Seat",script)
  111. seat9.Anchored = true
  112. seat9.CFrame = owner.Character.Head.CFrame * CFrame.new(0,1,12)
  113. seat9.Size = Vector3.new(1.5,1.5,2)
  114. owner.Character.Head.CFrame = owner.Character.Head.CFrame * CFrame.new(8,0,-1)
  115. task.wait()
  116. local tab = script:GetDescendants()
  117. for i,v in pairs(tab) do
  118. if i >= 2 then
  119. if v:IsA("BasePart") and tab[i - 1]:IsA("BasePart") then
  120. local weld = Instance.new("WeldConstraint")
  121. weld.Part0 = tab[i - 1]
  122. weld.Part1 = v
  123. weld.Parent = v
  124. end
  125. end
  126. end
  127. task.wait()
  128. for i,v in pairs(script:GetDescendants()) do
  129. pcall(function()
  130. v.Transparency = 1
  131. PhysicsService:SetPartCollisionGroup(v, car)
  132. v.Anchored = false
  133. end)
  134. end
  135. task.wait()
  136. local attttt0 = Instance.new("Attachment",par6)
  137. attttt0.CFrame = CFrame.new(0,2.4,1.2)
  138. local pe = Instance.new("ParticleEmitter", attttt0)
  139. pe.LightEmission = 0
  140. pe.LightInfluence = 1
  141. pe.EmissionDirection = Enum.NormalId.Back
  142. pe.VelocityInheritance = 0.5
  143. pe.Orientation = Enum.ParticleOrientation.FacingCamera
  144. pe.Size = NumberSequence.new{NumberSequenceKeypoint.new(0, 0.5),NumberSequenceKeypoint.new(1, 1)}
  145. pe.Texture = "rbxassetid://34098552"
  146. pe.Transparency = NumberSequence.new(0.2,0.4)
  147. pe.Lifetime = NumberRange.new(1,1.25)
  148. pe.Rate = 500
  149. pe.Rotation = NumberRange.new(math.random(-360,360))
  150. pe.RotSpeed = NumberRange.new(10)
  151. pe.Speed = NumberRange.new(1,3)
  152. pe.Acceleration = Vector3.new(0,10,0)
  153. pe.Color = ColorSequence.new(Color3.fromRGB(50, 50, 50))
  154. pe.SpreadAngle = Vector2.new(-5,5)
  155. pe.Drag = NumberRange.new(2,2.5)
  156. pe.Lifetime = NumberRange.new(1,1.2)
  157. vseat.MaxSpeed = 50
  158. vseat.Torque = 50
  159. vseat.TurnSpeed *= 1.5
  160. part2.Transparency = 0
  161. part3.Transparency = 0
  162. part4.Transparency = 0
  163. part.Transparency = 0
  164. local m = Instance.new("SpecialMesh",part2)
  165. m.MeshId = "rbxassetid://1210270510"
  166. m.TextureId = "rbxassetid://1210272315"
  167. m.Offset = Vector3.new(0,0.2,0.4) + Vector3.new(0,4.1,0)
  168. local m = Instance.new("SpecialMesh",part3)
  169. m.MeshId = "rbxassetid://1210270416"
  170. m.TextureId = "rbxassetid://1210272560"
  171. m.Offset = Vector3.new(0,-0.165,-0.65) + Vector3.new(0,4.1,0)
  172. m.Scale = Vector3.new(1,1,1)
  173. local m = Instance.new("SpecialMesh",part4)
  174. m.MeshId = "rbxassetid://1210270337"
  175. m.TextureId = "rbxassetid://1210273136"
  176. m.Offset = Vector3.new(0,-0.325,-0.55) + Vector3.new(0,4.1,0)
  177. local m = Instance.new("SpecialMesh",part)
  178. m.MeshId = "rbxassetid://1210267410"
  179. m.TextureId = "rbxassetid://1210272211"
  180. m.Offset = Vector3.new(0,4.1,0)
  181. part.Anchored = true
  182. local tool = Instance.new("Tool",owner.Backpack)
  183. tool.Name = "Bus Key"
  184. local key = Instance.new("Part",tool)
  185. key.Name = "Handle"
  186. key.Size = Vector3.new(0.5,0.25,0.75)
  187. local tool2 = Instance.new("Tool",owner.Backpack)
  188. tool2.Name = "Gas"
  189. local gass = Instance.new("Part",tool2)
  190. gass.Name = "Handle"
  191. gass.Size = Vector3.new(1.25, 2.164 + 0.5, 2)
  192. local m = Instance.new("SpecialMesh",gass)
  193. m.MeshId = "rbxassetid://461734736"
  194. m.TextureId = "rbxassetid://461734743"
  195. tool2.Grip = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(90),0)
  196. local istouched = false
  197. par9.Touched:Connect(function(wha)
  198. if wha == gass and gas ~= 3000 then
  199. istouched = true
  200. tool2.Grip = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(90),0) * CFrame.Angles(math.rad(45),0,0)
  201. end
  202. end)
  203. par9.TouchEnded:Connect(function(wha)
  204. if wha == gass then
  205. istouched = false
  206. tool2.Grip = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(90),0)
  207. end
  208. end)
  209. coroutine.wrap(function()
  210. while game:GetService("RunService").Heartbeat:Wait() do
  211. if istouched then
  212. gas = math.clamp(gas + 30,0,3000)
  213. if gas == 3000 then
  214. tool2.Grip = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(90),0)
  215. end
  216. end
  217. if gas == 3000 then
  218. tool2.Grip = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(90),0)
  219. end
  220. end
  221. end)()
  222. local wheel = Instance.new("Part",vseat)
  223. local wheel2 = Instance.new("Part",vseat)
  224. local wheel3 = Instance.new("Part",vseat)
  225. local wheel4 = Instance.new("Part",vseat)
  226. wheel.Material = "Fabric"
  227. wheel2.Material = "Fabric"
  228. wheel3.Material = "Fabric"
  229. wheel4.Material = "Fabric"
  230. PhysicsService:SetPartCollisionGroup(wheel, wheels)
  231. PhysicsService:SetPartCollisionGroup(wheel2, wheels)
  232. PhysicsService:SetPartCollisionGroup(wheel3, wheels)
  233. PhysicsService:SetPartCollisionGroup(wheel4, wheels)
  234. PhysicsService:CollisionGroupSetCollidable(car, wheels, false)
  235. wheel.Anchored = true
  236. wheel2.Anchored = true
  237. wheel3.Anchored = true
  238. wheel4.Anchored = true
  239. wheel.Size = Vector3.new(1,4,4)
  240. wheel.Shape = "Cylinder"
  241. wheel2.Size = Vector3.new(1,4,4)
  242. wheel2.Shape = "Cylinder"
  243. wheel3.Size = Vector3.new(1,4,4)
  244. wheel3.Shape = "Cylinder"
  245. wheel4.Size = Vector3.new(1,4,4)
  246. wheel4.Shape = "Cylinder"
  247. local m = Instance.new("SpecialMesh",wheel)
  248. m.MeshId = "rbxassetid://5738250964"
  249. m.TextureId = "rbxassetid://5738250999"
  250. local m = Instance.new("SpecialMesh",wheel2)
  251. m.MeshId = "rbxassetid://5738250964"
  252. m.TextureId = "rbxassetid://5738250999"
  253. local m = Instance.new("SpecialMesh",wheel3)
  254. m.MeshId = "rbxassetid://5738250964"
  255. m.TextureId = "rbxassetid://5738250999"
  256. local m = Instance.new("SpecialMesh",wheel4)
  257. m.MeshId = "rbxassetid://5738250964"
  258. m.TextureId = "rbxassetid://5738250999"
  259. wheel.CFrame = part.CFrame * CFrame.new(4.5,0,6.5)
  260. wheel2.CFrame = part.CFrame * CFrame.new(4.5,0,-9)
  261. wheel3.CFrame = part.CFrame * CFrame.new(-4.5,0,6.5)
  262. wheel3.CFrame = wheel3.CFrame * CFrame.Angles(0,math.rad(180),0)
  263. wheel4.CFrame = part.CFrame * CFrame.new(-4.5,0,-9)
  264. wheel4.CFrame = wheel4.CFrame * CFrame.Angles(0,math.rad(180),0)
  265. local density = 10
  266. local friction = 1
  267. local elasticity = 0
  268. local frictionWeight = 10000
  269. local elasticityWeight = 100000
  270. local physProperties = PhysicalProperties.new(density, friction, elasticity, frictionWeight, elasticityWeight)
  271. part.CustomPhysicalProperties = physProperties
  272. local density = 3
  273. local friction = 3
  274. local elasticity = 1
  275. local frictionWeight = 100
  276. local elasticityWeight = 1
  277. local physProperties = PhysicalProperties.new(density, friction, elasticity, frictionWeight, elasticityWeight)
  278. wheel.CustomPhysicalProperties = physProperties
  279. wheel2.CustomPhysicalProperties = physProperties
  280. wheel3.CustomPhysicalProperties = physProperties
  281. wheel4.CustomPhysicalProperties = physProperties
  282. local part29 = Instance.new("Part",part)
  283. part29.CanCollide = false
  284. part29.Transparency = 1
  285. local sound = Instance.new("Sound",part)
  286. sound.Looped = true
  287. sound.Volume = 0
  288. sound.SoundId = "rbxassetid://1289983500"
  289. sound:Play()
  290. local sound2 = Instance.new("Sound",part)
  291. sound2.Looped = true
  292. sound2.Volume = 0
  293. sound2:Play()
  294. sound2.SoundId = "rbxassetid://431021517"
  295. local brakes = Instance.new("Sound",part)
  296. brakes.Volume = 1.5
  297. brakes.SoundId = "rbxassetid://1704258021"
  298. brakes.PlaybackSpeed = 0.8
  299. local bigbrakes = Instance.new("Sound",part)
  300. bigbrakes.Volume = 0.5
  301. bigbrakes.Looped = true
  302. bigbrakes.SoundId = "rbxassetid://1858905327"
  303. local wha = false
  304. brakes.Ended:Connect(function()
  305. if wha == false then
  306. bigbrakes:Play()
  307. wha = true
  308. else
  309. wha = false
  310. end
  311. end)
  312. par9.Transparency = 0
  313. local steerw = Instance.new("Part",script)
  314. steerw.CanCollide = false
  315. local m = Instance.new("SpecialMesh",steerw)
  316. m.MeshId = "rbxassetid://129344524"
  317. m.TextureId = "rbxassetid://129344702"
  318. local wel4 = Instance.new("Weld",vseat)
  319. wel4.Part0 = steerw
  320. wel4.Part1 = vseat
  321. wel4.C1 = CFrame.new(-0.1,2.5,-2) * CFrame.Angles(math.rad(-35),0,0)
  322. local door1 = Instance.new("Part",script)
  323. door1.Size = Vector3.new(0.125,6.75,3.25 * 0.5)
  324. door1.Color = Color3.fromRGB(85,85,90)
  325. local wel = Instance.new("Weld",part)
  326. wel.Part0 = door1
  327. wel.Part1 = part
  328. wel.C1 = CFrame.new(4.4,3.125,-(((4.4 * 1.25) - 0.3) + 0.75))
  329. wel.C0 = CFrame.new(0,0,-0.75)
  330. local door2 = Instance.new("Part",script)
  331. door2.Size = Vector3.new(0.125,6.75,3.25 * 0.5)
  332. door2.Color = Color3.fromRGB(85,85,90)
  333. local wel2 = Instance.new("Weld",door1)
  334. wel2.Part0 = door2
  335. wel2.Part1 = door1
  336. wel2.C1 = CFrame.new(0,0,3.25 * 0.25)
  337. wel2.C0 = CFrame.new(0,0,-3.25 * 0.25)
  338. local tweenService = game:GetService("TweenService")
  339. local timeToFade = 2.5
  340. local object = wel
  341. local tweenInfo = TweenInfo.new(timeToFade,Enum.EasingStyle.Linear,Enum.EasingDirection.Out)
  342. local goal = {}
  343. goal.C0 = CFrame.new(0,0,-0.75) * CFrame.Angles(0,math.rad(-89),0)
  344. local doort = tweenService:Create(object, tweenInfo, goal)
  345. local goal = {}
  346. goal.C0 = CFrame.new(0,0,-0.75) * CFrame.Angles(0,math.rad(-0.5),0)
  347. local doort3 = tweenService:Create(object, tweenInfo, goal)
  348. local timeToFade = 2.5
  349. local object = wel2
  350. local tweenInfo = TweenInfo.new(timeToFade,Enum.EasingStyle.Linear,Enum.EasingDirection.Out)
  351. local goal = {}
  352. goal.C0 = CFrame.new(-0.125,0,-(3.25 * 0.25)) * CFrame.Angles(0,math.rad(179),0)
  353. local doort2 = tweenService:Create(object, tweenInfo, goal)
  354. local goal = {}
  355. goal.C0 = CFrame.new(0,0,-(3.25 * 0.25)) * CFrame.Angles(0,math.rad(0.5),0)
  356. local doort4 = tweenService:Create(object, tweenInfo, goal)
  357. doort:Play()
  358. doort2:Play()
  359. PhysicsService:SetPartCollisionGroup(door1, car)
  360. PhysicsService:SetPartCollisionGroup(door2, car)
  361. local prox = Instance.new("ProximityPrompt",vseat)
  362. prox.RequiresLineOfSight = false
  363. prox.KeyboardKeyCode = Enum.KeyCode.E
  364. prox.Style = Enum.ProximityPromptStyle.Custom
  365. mod = nil
  366. off = true
  367. local open = true
  368. local doorplay = true
  369. doort.Completed:Connect(function()
  370. doorplay = false
  371. end)
  372. doort3.Completed:Connect(function()
  373. doorplay = false
  374. end)
  375. prox.Triggered:Connect(function(player)
  376. if player.Character == mod then
  377. if not doorplay and open then
  378. doorplay = true
  379. open = false
  380. doort3:Play()
  381. doort4:Play()
  382. elseif not doorplay and not open then
  383. doorplay = true
  384. open = true
  385. doort:Play()
  386. doort2:Play()
  387. end
  388. end
  389. end)
  390. local part30 = Instance.new("Part",part)
  391. part30.CanCollide = false
  392. part30.Transparency = 1
  393. local ats = Instance.new("Attachment",part)
  394. ats.CFrame = CFrame.new(-4,0,-9) * CFrame.Angles(0,0,math.rad(90))
  395. local ats2 = Instance.new("Attachment",part29)
  396. ats2.CFrame = CFrame.Angles(0,0,math.rad(90))
  397. part29.CFrame = part.CFrame * ats.CFrame
  398. steer = Instance.new("HingeConstraint")
  399. steer.Parent = part
  400. steer.ActuatorType = "Servo"
  401. steer.TargetAngle = 0
  402. steer.ServoMaxTorque = 10000000000000000
  403. steer.AngularSpeed = 100000000000000
  404. steer.Attachment0 = ats
  405. steer.Attachment1 = ats2
  406. part30 = Instance.new("Part",part)
  407. part30.CanCollide = false
  408. part30.Transparency = 1
  409. local ats3 = Instance.new("Attachment",part)
  410. ats3.CFrame = CFrame.new(4,0,-9) * CFrame.Angles(0,0,math.rad(90))
  411. local ats4 = Instance.new("Attachment",part30)
  412. ats4.CFrame = CFrame.Angles(0,0,math.rad(90))
  413. part30.CFrame = part.CFrame * ats3.CFrame
  414. steer2 = Instance.new("HingeConstraint")
  415. steer2.Parent = part
  416. steer2.ActuatorType = "Servo"
  417. steer2.TargetAngle = 0
  418. steer2.ServoMaxTorque = 10000000000000000
  419. steer2.AngularSpeed = 100000000000000
  420. steer2.Attachment0 = ats3
  421. steer2.Attachment1 = ats4
  422.  
  423. local atl = Instance.new("Attachment",part30)
  424. local atl2 = Instance.new("Attachment",wheel2)
  425. local mot1 = Instance.new("HingeConstraint")
  426. mot1.Parent = part
  427. mot1.Attachment0 = atl
  428. mot1.Attachment1 = atl2
  429.  
  430. local atl3 = Instance.new("Attachment",part)
  431. atl3.CFrame = CFrame.new(4,0,6.5)
  432. local atl4 = Instance.new("Attachment",wheel)
  433. local mot2 = Instance.new("HingeConstraint")
  434. wheel.CFrame = atl4.WorldCFrame
  435. mot2.Parent = part
  436. mot2.ActuatorType = "Motor"
  437. mot2.MotorMaxAcceleration = math.huge-1
  438. mot2.MotorMaxTorque = math.huge-1
  439. mot2.Attachment0 = atl3
  440. mot2.Attachment1 = atl4
  441.  
  442. local atl5 = Instance.new("Attachment",part29)
  443. local atl6 = Instance.new("Attachment",wheel3)
  444. atl5.CFrame = atl5.CFrame * CFrame.Angles(0,math.rad(180),0)
  445. wheel3.CFrame = atl6.WorldCFrame
  446. local mot3 = Instance.new("HingeConstraint")
  447. mot3.Parent = part
  448. mot3.Attachment0 = atl5
  449. mot3.Attachment1 = atl6
  450.  
  451.  
  452. local atl7 = Instance.new("Attachment",part)
  453. atl7.CFrame = CFrame.new(-4,0,6.5)
  454. local atl8 = Instance.new("Attachment",wheel4)
  455. atl7.CFrame = atl7.CFrame * CFrame.Angles(0,math.rad(180),0)
  456. wheel4.CFrame = atl8.WorldCFrame
  457. local mot4 = Instance.new("HingeConstraint")
  458. mot4.Parent = part
  459. mot4.ActuatorType = "Motor"
  460. mot4.MotorMaxAcceleration = math.huge-1
  461. mot4.MotorMaxTorque = math.huge-1
  462. mot4.Attachment0 = atl7
  463. mot4.Attachment1 = atl8
  464. wait()
  465. part.Anchored = false
  466. wheel.Anchored = false
  467. wheel2.Anchored = false
  468. wheel3.Anchored = false
  469. wheel4.Anchored = false
  470. local currentthrot = 0
  471. speed = 0
  472. local hittab = {}
  473. par.Touched:Connect(function(wha)
  474. if (wha.Anchored == true or (wha:GetMass() > 500 and not wha:FindFirstAncestorWhichIsA("Model"))) and speed > 5 and wha.CanCollide then
  475. speed = 0
  476. elseif (wha.Anchored == true or (wha:GetMass() > 250 and wha:GetMass() < 500 and not wha:FindFirstAncestorWhichIsA("Model"))) and speed > 5 and wha.CanCollide then
  477. speed = speed * 0.5
  478. elseif wha.Anchored == false and speed > 5 then
  479. if wha:FindFirstAncestorWhichIsA("Model") and wha:FindFirstAncestorWhichIsA("Model"):FindFirstChildWhichIsA("Humanoid") and not table.find(hittab,wha:FindFirstAncestorWhichIsA("Model")) then
  480. table.insert(hittab,wha:FindFirstAncestorWhichIsA("Model"))
  481. wha:FindFirstAncestorWhichIsA("Model"):FindFirstChildWhichIsA("Humanoid").Health -= speed + 20
  482. wha:FindFirstAncestorWhichIsA("Model"):FindFirstChildWhichIsA("Humanoid").Sit = true
  483. pcall(function()
  484. local rnd = Random.new()
  485. local bv = Instance.new("BodyVelocity", wha:FindFirstAncestorWhichIsA("Model").Head)
  486. bv.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
  487. bv.Velocity = (part.CFrame.lookVector * (50 + speed)) + Vector3.new(0, 50 + speed, 0)
  488. game:GetService("Debris"):AddItem(bv,task.wait(.05))
  489. task.wait(.05)
  490. bv.MaxForce = Vector3.new()
  491. bv.Velocity = Vector3.new()
  492. wha:FindFirstAncestorWhichIsA("Model").Head.RotVelocity = Vector3.new(rnd:NextNumber(-5, 5), rnd:NextNumber(-5, 5), rnd:NextNumber(-5, 5))
  493. end)
  494. delay(2,function()
  495. table.remove(hittab,table.find(hittab,wha:FindFirstAncestorWhichIsA("Model")))
  496. end)
  497. end
  498. end
  499. end)
  500. par7.Touched:Connect(function(wha)
  501. if (wha.Anchored == true or (wha:GetMass() > 500 and not wha:FindFirstAncestorWhichIsA("Model"))) and speed > 5 and wha.CanCollide then
  502. speed = 0
  503. elseif wha.Anchored == false and speed > 5 then
  504. if wha:FindFirstAncestorWhichIsA("Model") and wha:FindFirstAncestorWhichIsA("Model"):FindFirstChildWhichIsA("Humanoid") and not table.find(hittab,wha:FindFirstAncestorWhichIsA("Model")) then
  505. table.insert(hittab,wha:FindFirstAncestorWhichIsA("Model"))
  506. wha:FindFirstAncestorWhichIsA("Model"):FindFirstChildWhichIsA("Humanoid").Health -= speed + 20
  507. wha:FindFirstAncestorWhichIsA("Model"):FindFirstChildWhichIsA("Humanoid").Sit = true
  508. delay(2,function()
  509. table.remove(hittab,table.find(hittab,wha:FindFirstAncestorWhichIsA("Model")))
  510. end)
  511. end
  512. end
  513. end)
  514. local function carMove(property)
  515. if property == "ThrottleFloat" then
  516. if vseat.ThrottleFloat ~= 0 then
  517. currentthrot = vseat.ThrottleFloat
  518. throt = true
  519. else
  520. currentthrot = 0
  521. throt = false
  522. end
  523. elseif property == "Occupant" then
  524. pcall(function()
  525. if vseat.Occupant ~= nil then
  526. if vseat.Occupant:FindFirstAncestorWhichIsA("Model"):FindFirstChild("Bus Key") or game:GetService("Players"):GetPlayerFromCharacter(vseat.Occupant:FindFirstAncestorWhichIsA("Model")).Backpack:FindFirstChild("Bus Key") then
  527. mod = vseat.Occupant:FindFirstAncestorWhichIsA("Model")
  528. off = false
  529. coroutine.wrap(function()
  530. for i = 1,5 do
  531. sound.Volume = math.clamp(sound.Volume + 0.4,0,20)
  532. game:GetService("RunService").Heartbeat:Wait()
  533. end
  534. end)()
  535. part:SetNetworkOwner(game:GetService("Players"):GetPlayerFromCharacter(vseat.Occupant:FindFirstAncestorWhichIsA("Model")))
  536. vseat:SetNetworkOwner(game:GetService("Players"):GetPlayerFromCharacter(vseat.Occupant:FindFirstAncestorWhichIsA("Model")))
  537. else
  538. mod = nil
  539. off = true
  540. coroutine.wrap(function()
  541. for i = 1,5 do
  542. sound.Volume = 0
  543. game:GetService("RunService").Heartbeat:Wait()
  544. end
  545. end)()
  546. part:SetNetworkOwner(owner)
  547. vseat:SetNetworkOwner(owner)
  548. end
  549. else
  550. mod = nil
  551. off = true
  552. coroutine.wrap(function()
  553. for i = 1,5 do
  554. sound.Volume = 0
  555. game:GetService("RunService").Heartbeat:Wait()
  556. end
  557. end)()
  558. part:SetNetworkOwner(owner)
  559. vseat:SetNetworkOwner(owner)
  560. end
  561. end)
  562. end
  563. end
  564. lastthrot = 0
  565. vseat.Changed:Connect(carMove)
  566. coroutine.wrap(function()
  567. while game:GetService("RunService").Heartbeat:Wait() do
  568. if not off and gas ~= 0 then
  569. steer.TargetAngle = 35 * -vseat.SteerFloat
  570. steer2.TargetAngle = 35 * -vseat.SteerFloat
  571. wel4.C0 = wel4.C0:lerp(CFrame.Angles(0,0,math.rad(70 * vseat.SteerFloat)),0.15)
  572. gas = math.clamp(gas - 1,0,3000)
  573. else
  574. steer.TargetAngle = 12.5 * -vseat.SteerFloat
  575. steer2.TargetAngle = 12.5 * -vseat.SteerFloat
  576. wel4.C0 = wel4.C0:lerp(CFrame.Angles(0,0,math.rad(25 * vseat.SteerFloat)),0.15)
  577. end
  578. end
  579. end)()
  580. local reverse = false
  581. while game:GetService("RunService").Heartbeat:Wait() do
  582. if throt and math.clamp(currentthrot * math.huge,-1,1) ~= -lastthrot and not off and gas ~= 0 then
  583. lastthrot = vseat.Throttle
  584. bigbrakes:Stop()
  585. game:GetService("RunService").Heartbeat:Wait(0.0525)
  586. speed = math.clamp(speed + (0.75 * 0.25),0,30)
  587. sound2.Volume = ((vseat.ThrottleFloat * speed) * 0.05)
  588. mot2.AngularVelocity = vseat.ThrottleFloat * -(speed - (vseat.SteerFloat))
  589. mot4.AngularVelocity = -vseat.ThrottleFloat * -(speed + (vseat.SteerFloat))
  590. elseif throt and math.clamp(currentthrot * math.huge,-1,1) == -lastthrot and not off and gas ~= 0 then
  591. brakes.Volume = 1
  592. brakes:Play()
  593. sound2.Volume = ((vseat.ThrottleFloat * speed) * 0.05)
  594. for i = 1, 35 do
  595. game:GetService("RunService").Heartbeat:Wait(0.0525)
  596. speed = math.clamp(speed - (1 * 0.5),0,25)
  597. mot2.AngularVelocity = lastthrot * -(speed - (vseat.SteerFloat))
  598. mot4.AngularVelocity = -lastthrot * -(speed + (vseat.SteerFloat))
  599. if speed == 0 then
  600. lastthrot = vseat.Throttle
  601. bigbrakes:Stop()
  602. brakes.Volume = 0.5
  603. brakes:Play()
  604. if speed == 0 then break end
  605. end
  606. end
  607. elseif not throt or off or gas == 0 then
  608. if speed ~= 0 then
  609. game:GetService("RunService").Heartbeat:Wait(0.0325)
  610. else
  611. bigbrakes:Stop()
  612. end
  613. sound2.Volume = ((vseat.ThrottleFloat * speed) * 0.05)
  614. speed = math.clamp(speed - (0.75 * 0.5),0,30)
  615. mot2.AngularVelocity = lastthrot * -(speed)
  616. mot4.AngularVelocity = -lastthrot * -(speed)
  617. end
  618. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement