Advertisement
TheUnknownDiscord

truck

Apr 5th, 2022 (edited)
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.68 KB | None | 0 0
  1. local PhysicsService = game:GetService("PhysicsService")
  2. local pards = {}
  3. local pards2 = {}
  4. local car = "car"
  5. local wheels = "wheels"
  6. pcall(function()
  7.  
  8. -- Create two collision groups
  9. PhysicsService:CreateCollisionGroup(car)
  10. PhysicsService:CreateCollisionGroup(wheels)
  11. PhysicsService:SetPartCollisionGroup(pards, car)
  12. PhysicsService:SetPartCollisionGroup(pards2, wheels)
  13.  
  14. PhysicsService:CollisionGroupSetCollidable(car, wheels, false)
  15. end)
  16. function suspension(what,cf,mot,dir)
  17. local a = Instance.new("Part", script)
  18. local a2 = Instance.new("Part", script)
  19. local a3 = Instance.new("Part", script)
  20. local a4 = Instance.new("Part", script)
  21. a4.Locked = true
  22. a.Locked = true
  23. a2.Locked = true
  24. a3.Locked = true
  25. PhysicsService:SetPartCollisionGroup(a, wheels)
  26. PhysicsService:SetPartCollisionGroup(a4, wheels)
  27. PhysicsService:SetPartCollisionGroup(a2, wheels)
  28. PhysicsService:SetPartCollisionGroup(a3, wheels)
  29. a2.Name = "the"
  30. a4.Name = "the"
  31. a3.Name = "the"
  32. a.Name = "the"
  33. local density = 3
  34. local friction = 3
  35. local elasticity = 0
  36. local frictionWeight = 10000
  37. local elasticityWeight = 100000
  38. local physProperties = PhysicalProperties.new(density, friction, elasticity, frictionWeight, elasticityWeight)
  39. a2.CustomPhysicalProperties = physProperties
  40. a.Size = Vector3.new(1,1,1)
  41. a2.Size = Vector3.new(1.375,3.125,3.125)
  42. a2.Shape = "Cylinder"
  43. a2.Material = "Plastic"
  44. a3.Size = Vector3.new(0.125,1.75,1.75)
  45. a3.Shape = "Cylinder"
  46. a3.CanCollide = false
  47. a3.Material = "SmoothPlastic"
  48. a3.Color = Color3.fromRGB(163,162,165)
  49. a2.Color = Color3.fromRGB(27,42,53)
  50. local weld = Instance.new("Weld",a2)
  51. weld.Part0 = a3
  52. weld.Part1 = a2
  53. a.CFrame = what.CFrame * cf:Inverse()
  54. a.Anchored = true
  55. a2.CFrame = what.CFrame * cf:Inverse() * CFrame.new(1,0,0)
  56. a2.Anchored = true
  57. a4.CFrame = what.CFrame * cf:Inverse() * CFrame.new(1,0,0)
  58. a4.Anchored = true
  59. a.Transparency = 1
  60. a4.Transparency = 1
  61. a.CanCollide = false
  62. a4.CanCollide = false
  63. local mesh = Instance.new("SpecialMesh",a2)
  64. mesh.Scale = Vector3.new(0.825,0.725,0.725)
  65. mesh.MeshId = "rbxassetid://432499736"
  66. local mesh2 = Instance.new("SpecialMesh",a3)
  67. mesh2.Scale = Vector3.new(0.675,0.675,0.675)
  68. mesh2.MeshId = "rbxassetid://432499736"
  69. local at0 = Instance.new("Attachment" , a)
  70. if not mot then
  71. at0.CFrame = CFrame.new(0.5,-1,0) * CFrame.Angles(0,math.rad(-90),math.rad(90))
  72. else
  73. at0.CFrame = CFrame.new(2,-1,0) * CFrame.Angles(0,math.rad(-90),math.rad(90))
  74. end
  75. local at1 = Instance.new("Attachment" , a4)
  76. at1.CFrame = CFrame.Angles(0,0,math.rad(180))
  77. local att3 = Instance.new("Attachment" , a2)
  78. local at2 = Instance.new("Attachment" , a)
  79. at2.CFrame = CFrame.Angles(0,0,math.rad(90)) * CFrame.new(1,0,0)
  80. local att4 = Instance.new("Attachment" , a4)
  81. att4.CFrame = CFrame.Angles(0,0,0) * CFrame.Angles(math.rad(180),math.rad(90),0)
  82. local att5 = Instance.new("Attachment" , what)
  83. att5.CFrame = CFrame.Angles(0,0,0) * CFrame.Angles(math.rad(180),math.rad(90),0)
  84. local pe = Instance.new("ParticleEmitter", at0)
  85. pe.LightEmission = 0
  86. pe.LightInfluence = 1
  87. pe.EmissionDirection = dir
  88. pe.VelocityInheritance = 0.35
  89. pe.Orientation = Enum.ParticleOrientation.FacingCamera
  90. pe.Size = NumberSequence.new(0.85,1.25)
  91. pe.Texture = "rbxassetid://34098552"
  92. pe.Transparency = NumberSequence.new(0.4,0.6)
  93. pe.Lifetime = NumberRange.new(1,1.25)
  94. pe.Rate = 200
  95. pe.Rotation = NumberRange.new(math.random(-360,360))
  96. pe.RotSpeed = NumberRange.new(10)
  97. pe.Speed = NumberRange.new(5)
  98. pe.SpreadAngle = Vector2.new(-15,15)
  99. pe.Drag = NumberRange.new(1)
  100. pe.Enabled = false
  101. coroutine.wrap(function()
  102. while a3.Parent ~= nil do
  103. task.wait()
  104. if a3.Velocity.Magnitude >= 2 then
  105. pe.Enabled = true
  106. else
  107. pe.Enabled = false
  108. end
  109. end
  110. end)()
  111. local prism = Instance.new("CylindricalConstraint" , a)
  112. prism.Attachment0 = at0
  113. prism.InclinationAngle = 90
  114. prism.Attachment1 = at1
  115. prism.LimitsEnabled = true
  116. prism.LowerLimit = -1.5
  117. prism.UpperLimit = 1.5
  118. prism.Restitution = 0.3
  119. prism.AngularLimitsEnabled = true
  120. prism.LowerAngle = 15
  121. prism.UpperAngle = -5
  122. local tor = Instance.new("TorsionSpringConstraint" , what)
  123. tor.Stiffness = 300000
  124. tor.Attachment0 = att5
  125. tor.Attachment1 = att4
  126. tor.Damping = 10
  127. tor.Restitution = 0.1
  128. tor.Visible = true
  129. tor.MaxAngle = 1
  130. tor.MaxTorque = math.huge
  131. local spring = Instance.new("SpringConstraint" , a)
  132. spring.Attachment0 = att3
  133. spring.Attachment1 = at2
  134. spring.Stiffness = 30000
  135. if not mot then
  136. spring.FreeLength = (2.2 * 0.5) * 0.5
  137. else
  138. spring.FreeLength = 2.2
  139. end
  140. spring.Enabled = true
  141. spring.Damping = 410
  142. local att0 = Instance.new("Attachment",a4)
  143. local att1 = Instance.new("Attachment",a2)
  144. att0.CFrame = CFrame.Angles(0,math.rad(-90),0)
  145. local ro = Instance.new("HingeConstraint",a4)
  146. ro.Attachment0 = att0
  147. ro.Attachment1 = att1
  148. ro.ActuatorType = "Motor"
  149. ro.MotorMaxAcceleration = math.huge-1
  150. ro.MotorMaxTorque = math.huge-1
  151. wait()
  152. a2.Anchored = false
  153. a.Anchored = false
  154. a4.Anchored = false
  155. local wel = Instance.new("Weld",what)
  156. wel.Part0 = a
  157. wel.Part1 = what
  158. wel.C0 = cf
  159. return ro
  160. end
  161. part = Instance.new("VehicleSeat",script)
  162. part.MaxSpeed = 100000
  163. part.Torque = math.huge
  164. part.Anchored = true
  165. part.CFrame = owner.Character.Head.CFrame * CFrame.new(0,-4,-2) * CFrame.Angles(0,math.rad(-90),0)
  166. part31 = Instance.new("Part",script)
  167. part31.Anchored = true
  168. part31.CFrame = owner.Character.Head.CFrame * CFrame.new(0,-2,-2)
  169. part31.Size = Vector3.new(5,3,7)
  170. part2 = Instance.new("Part",script)
  171. part2.Anchored = true
  172. part2.CFrame = owner.Character.Head.CFrame * CFrame.new(-11.75,-1.5,-2)
  173. part2.Size = Vector3.new(0.25,2.5,7)
  174. part3 = Instance.new("Part",script)
  175. part3.Anchored = true
  176. part3.CFrame = owner.Character.Head.CFrame * CFrame.new(-11.95,-1.5,-2)
  177. part3.Size = Vector3.new(0.175,2.25,7)
  178. part4 = Instance.new("Part",script)
  179. part4.Anchored = true
  180. part4.CFrame = owner.Character.Head.CFrame * CFrame.new(-12.15,-2.5,-2)
  181. part4.Size = Vector3.new(0.75,0.75,7)
  182. part5 = Instance.new("Part",script)
  183. part5.Anchored = true
  184. part5.CFrame = owner.Character.Head.CFrame * CFrame.new(-7.125,-0.85,1.35)
  185. part5.Size = Vector3.new(9,1.25,0.25)
  186. part6 = Instance.new("Part",script)
  187. part6.Anchored = true
  188. part6.CFrame = owner.Character.Head.CFrame * CFrame.new(-7.125,-0.85,-5.35)
  189. part6.Size = Vector3.new(9,1.25,0.25)
  190. part7 = Instance.new("Part",script)
  191. part7.Anchored = true
  192. part7.CFrame = owner.Character.Head.CFrame * CFrame.new(-4.25,-2.25,1.35)
  193. part7.Size = Vector3.new(3,1.75,0.25)
  194. part8 = Instance.new("Part",script)
  195. part8.Anchored = true
  196. part8.CFrame = owner.Character.Head.CFrame * CFrame.new(-6.15,-2.25,0.85) * CFrame.Angles(0,0,math.rad(15))
  197. part8.Size = Vector3.new(0.25,2,1.35)
  198. part9 = Instance.new("Part",script)
  199. part9.Anchored = true
  200. part9.CFrame = owner.Character.Head.CFrame * CFrame.new(-9.5,-2.0625,0.85) * CFrame.Angles(0,0,math.rad(-15))
  201. part9.Size = Vector3.new(0.25,1.65,1.35)
  202. part10 = Instance.new("Part",script)
  203. part10.Anchored = true
  204. part10.CFrame = owner.Character.Head.CFrame * CFrame.new(-7.85,-1.25,0.85)
  205. part10.Size = Vector3.new(2.85,0.25,1.35)
  206. part11 = Instance.new("Part",script)
  207. part11.Anchored = true
  208. part11.CFrame = owner.Character.Head.CFrame * CFrame.new(-7.85,-1.85,-0.0625) * CFrame.Angles(math.rad(15),0,0)
  209. part11.Size = Vector3.new(2.85,1.35,0.25)
  210. part12 = Instance.new("Part",script)
  211. part12.Anchored = true
  212. part12.CFrame = owner.Character.Head.CFrame * CFrame.new(-6.15,-2.25,-4.8625) * CFrame.Angles(0,0,math.rad(15))
  213. part12.Size = Vector3.new(0.25,2,1.35)
  214. part13 = Instance.new("Part",script)
  215. part13.Anchored = true
  216. part13.CFrame = owner.Character.Head.CFrame * CFrame.new(-9.5,-2.0625,-4.8625) * CFrame.Angles(0,0,math.rad(-15))
  217. part13.Size = Vector3.new(0.25,1.65,1.35)
  218. part14 = Instance.new("Part",script)
  219. part14.Anchored = true
  220. part14.CFrame = owner.Character.Head.CFrame * CFrame.new(-7.85,-1.25,-4.8625)
  221. part14.Size = Vector3.new(2.85,0.25,1.35)
  222. part15 = Instance.new("Part",script)
  223. part15.Anchored = true
  224. part15.CFrame = owner.Character.Head.CFrame * CFrame.new(-7.85,-1.85,-3.95) * CFrame.Angles(math.rad(-15),0,0)
  225. part15.Size = Vector3.new(2.85,1.35,0.25)
  226. part16 = Instance.new("Part",script)
  227. part16.Anchored = true
  228. part16.CFrame = owner.Character.Head.CFrame * CFrame.new(-7.85,-2.25,-2)
  229. part16.Size = Vector3.new(4,0.25,4)
  230. part17 = Instance.new("Part",script)
  231. part17.Anchored = true
  232. part17.CFrame = owner.Character.Head.CFrame * CFrame.new(-10.625,-2.25,-2)
  233. part17.Size = Vector3.new(2.25,0.25,6.25)
  234. part18 = Instance.new("Part",script)
  235. part18.Anchored = true
  236. part18.CFrame = owner.Character.Head.CFrame * CFrame.new(-4.625,-2.25,-2)
  237. part18.Size = Vector3.new(2.5,0.25,6.25)
  238. part19 = Instance.new("Part",script)
  239. part19.Anchored = true
  240. part19.CFrame = owner.Character.Head.CFrame * CFrame.new(-4.25,-2.25,-5.35)
  241. part19.Size = Vector3.new(3,1.75,0.25)
  242. part20 = Instance.new("Part",script)
  243. part20.Anchored = true
  244. part20.CFrame = owner.Character.Head.CFrame * CFrame.new(-3,-1.5,-2)
  245. part20.Size = Vector3.new(0.25,2.5,6.25)
  246. part21 = Instance.new("Part",script)
  247. part21.Anchored = true
  248. part21.CFrame = owner.Character.Head.CFrame * CFrame.new(-2.65,-0.5,-2)
  249. part21.Size = Vector3.new(0.25,4.5,4.25)
  250. part22 = Instance.new("Part",script)
  251. part22.Anchored = true
  252. part22.CFrame = owner.Character.Head.CFrame * CFrame.new(-1.425,0.5,0.45) * CFrame.Angles(math.rad(-20),0,0)
  253. part22.Size = Vector3.new(2.75,2.25,1)
  254. part23 = Instance.new("Part",script)
  255. part23.Anchored = true
  256. part23.CFrame = owner.Character.Head.CFrame * CFrame.new(-1.425,0.5,-4.45) * CFrame.Angles(math.rad(20),0,0)
  257. part23.Size = Vector3.new(2.75,2.25,1)
  258. part24 = Instance.new("Part",script)
  259. part24.Anchored = true
  260. part24.CFrame = owner.Character.Head.CFrame * CFrame.new(0.75,0.5,-0.65) * CFrame.Angles(0,math.rad(-10),math.rad(40))
  261. part24.Size = Vector3.new(1,2.25,2.85)
  262. part25 = Instance.new("Part",script)
  263. part25.Anchored = true
  264. part25.CFrame = owner.Character.Head.CFrame * CFrame.new(0.75,0.5,-3.35) * CFrame.Angles(0,math.rad(10),math.rad(40))
  265. part25.Size = Vector3.new(1,2.25,2.85)
  266. part26 = Instance.new("Part",script)
  267. part26.Anchored = true
  268. part26.CFrame = owner.Character.Head.CFrame * CFrame.new(4,-0.85,-2)
  269. part26.Size = Vector3.new(4,1,6.5)
  270. part27 = Instance.new("Part",script)
  271. part27.Anchored = true
  272. part27.CFrame = owner.Character.Head.CFrame * CFrame.new(6.25,-1.75,-2)
  273. part27.Size = Vector3.new(1,2.25,7)
  274. part28 = Instance.new("Part",script)
  275. part28.Anchored = true
  276. part28.CFrame = owner.Character.Head.CFrame * CFrame.new(6.5,-2.75,-2)
  277. part28.Size = Vector3.new(1,0.75,7.25)
  278. local mesh = Instance.new("SpecialMesh",part31)
  279. mesh.Scale = Vector3.new(0.4,0.4,0.4)
  280. mesh.MeshId = "rbxassetid://3656796538"
  281. mesh.TextureId = "rbxassetid://3656802356"
  282. mesh.Offset = Vector3.new(-2.5,1.5,0)
  283. part.Size = Vector3.new(5.5,2.5,7.75)
  284. local idle = Instance.new("Sound",part)
  285. idle.Looped = true
  286. idle.SoundId = "rbxassetid://520998094"
  287. idle.Volume = 0
  288. idle:Play()
  289. local sound = Instance.new("Sound",part)
  290. sound.Looped = true
  291. sound.Volume = 0
  292. sound.SoundId = "rbxassetid://6851694831"
  293. local start = Instance.new("Sound",part)
  294. start.Volume = 2
  295. start.SoundId = "rbxassetid://9075587875"
  296. local tweenService = game:GetService("TweenService")
  297. local timeToFade = 1.5
  298. local object = start
  299. local tweenInfo = TweenInfo.new(timeToFade,Enum.EasingStyle.Linear)
  300. local goal = {}
  301. goal.Volume = 2
  302.  
  303. local tween = tweenService:Create(object, tweenInfo, goal)
  304. sound:Play()
  305. part32 = Instance.new("Part",script)
  306. part32.Anchored = true
  307. part32.CFrame = owner.Character.Head.CFrame * CFrame.new(-8,0.25,0.75)
  308. part32.Size = Vector3.new(0.455,1.035, 1.035)
  309. part32.Color = Color3.fromRGB(190, 104, 98)
  310. part32.Material = "Glass"
  311. part33 = Instance.new("Part",script)
  312. part33.Anchored = true
  313. part33.CFrame = owner.Character.Head.CFrame * CFrame.new(-8,0.25,-4.75)
  314. part33.Size = Vector3.new(0.455,1.035, 1.035)
  315. part33.Color = Color3.fromRGB(190, 104, 98)
  316. part33.Material = "Glass"
  317. part33.Transparency = 1
  318. part33.CanCollide = false
  319. part32.CanCollide = false
  320. part32.Transparency = 1
  321. part34 = Instance.new("Part",script)
  322. part34.Anchored = true
  323. part34.CFrame = owner.Character.Head.CFrame * CFrame.new(6.85,-1.5,-4.9)
  324. part34.Size = Vector3.new(0.095,1.135, 0.535)
  325. part34.Material = "Glass"
  326. part35 = Instance.new("Part",script)
  327. part35.Anchored = true
  328. part35.CFrame = owner.Character.Head.CFrame * CFrame.new(6.85,-1.5,0.9)
  329. part35.Size = Vector3.new(0.095,1.135, 0.535)
  330. part35.Material = "Glass"
  331. local parts = Instance.new("Seat",script)
  332. parts.Anchored = true
  333. parts.CFrame = owner.Character.Head.CFrame * CFrame.new(-4.85,-2,0.75)
  334. parts.Size = Vector3.new(2,1,1)
  335. parts.Color = Color3.fromRGB(150, 92, 17)
  336. parts.Material = "Slate"
  337. parts.Massless = true
  338. local parts2 = Instance.new("Seat",script)
  339. parts2.Anchored = true
  340. parts2.CFrame = owner.Character.Head.CFrame * CFrame.new(-4.85,-2,-4.75) * CFrame.Angles(0,math.rad(180),0)
  341. parts2.Size = Vector3.new(2,1,1)
  342. parts2.Color = Color3.fromRGB(150, 92, 17)
  343. parts2.Material = "Slate"
  344. parts2.Massless = true
  345. local hitdb = false
  346. mod = nil
  347. local bed = false
  348. local welds = {}
  349. prox4 = Instance.new("ProximityPrompt",part)
  350. prox4.RequiresLineOfSight = false
  351. prox4.Style = Enum.ProximityPromptStyle.Custom
  352. prox4.KeyboardKeyCode = Enum.KeyCode.Y
  353. prox4.Triggered:Connect(function(player)
  354. if player.Character == mod then
  355. if not bed then
  356. bed = true
  357. local params = OverlapParams.new()
  358. params.FilterDescendantsInstances = {script:GetDescendants()}
  359. params.FilterType = Enum.RaycastFilterType.Blacklist
  360. for _, v in pairs(workspace:GetPartBoundsInBox(part.CFrame * CFrame.new(0,1.5,4), Vector3.new(6,3,10), params)) do
  361. local weld = Instance.new("WeldConstraint",part)
  362. weld.Part0 = v
  363. weld.Part1 = part
  364. table.insert(welds,weld)
  365. end
  366. elseif bed then
  367. for i,v in pairs(welds) do
  368. v:Destroy()
  369. end
  370. wait()
  371. welds = {}
  372. end
  373. end
  374. end)
  375. wait()
  376. beam1 = Instance.new("Beam")
  377. beam1.Texture = "rbxassetid://175588117"
  378. beam1.TextureLength = 1
  379. beam1.LightEmission = 1
  380. beam1.CurveSize0 = 0
  381. beam1.CurveSize1 = 0
  382. beam1.FaceCamera = true
  383. beam1.Segments = 2
  384. beam1.Width0 = 1
  385. beam1.Width1 = 8
  386. beam1.Enabled = false
  387. beam1.Transparency = NumberSequence.new{NumberSequenceKeypoint.new(0, 0),NumberSequenceKeypoint.new(1, 1)}
  388. local bat1 = Instance.new("Attachment",part)
  389. bat1.WorldCFrame = part34.CFrame
  390. local bat2 = Instance.new("Attachment",part34)
  391. bat2.WorldCFrame = part34.CFrame * CFrame.new(24,0,0)
  392. beam1.Attachment0 = bat1
  393. beam1.Attachment1 = bat2
  394. beam1.Parent = part
  395. local lon = false
  396. function lights(on)
  397. if on then
  398. part33.Color = Color3.fromRGB(190, 104, 98)
  399. part33.Material = "Neon"
  400. part32.Color = Color3.fromRGB(190, 104, 98)
  401. part32.Material = "Neon"
  402. else
  403. part33.Color = Color3.fromRGB(190, 104, 98)
  404. part33.Material = "Glass"
  405. part32.Color = Color3.fromRGB(190, 104, 98)
  406. part32.Material = "Glass"
  407. end
  408. end
  409. wait()
  410. beam2 = Instance.new("Beam",part)
  411. beam2.Texture = "rbxassetid://175588117"
  412. beam2.TextureLength = 1
  413. beam2.LightEmission = 1
  414. beam2.CurveSize0 = 0
  415. beam2.CurveSize1 = 0
  416. beam2.FaceCamera = true
  417. beam2.Segments = 2
  418. beam2.Width0 = 1
  419. beam2.Width1 = 8
  420. beam2.Enabled = false
  421. beam2.Transparency = NumberSequence.new{NumberSequenceKeypoint.new(0, 0),NumberSequenceKeypoint.new(1, 1)}
  422. local bat3 = Instance.new("Attachment",part)
  423. bat3.WorldCFrame = part35.CFrame
  424. local bat4 = Instance.new("Attachment",part35)
  425. bat4.WorldCFrame = part35.CFrame * CFrame.new(24,0,0)
  426. beam2.Attachment0 = bat3
  427. beam2.Attachment1 = bat4
  428. lat = Instance.new("Attachment",part)
  429. lat.CFrame = CFrame.new(0,0,-6)
  430. light = Instance.new("SpotLight",lat)
  431. light.Enabled = false
  432. light.Range = 24
  433. light.Face = "Front"
  434. light.Color = Color3.fromRGB(255,255,255)
  435. light.Brightness = 3
  436. light.Angle = 85
  437. function headlights()
  438. beam1.Enabled = not beam1.Enabled
  439. beam2.Enabled = not beam2.Enabled
  440. light.Enabled = not light.Enabled
  441. if not lon then
  442. lon = true
  443. part34.Color = Color3.fromRGB(232, 232, 232)
  444. part34.Material = "Neon"
  445. part35.Color = Color3.fromRGB(232, 232, 232)
  446. part35.Material = "Neon"
  447. else
  448. lon = false
  449. part35.Color = Color3.fromRGB(248, 248, 248)
  450. part34.Material = "Glass"
  451. part35.Color = Color3.fromRGB(248, 248, 248)
  452. part35.Material = "Glass"
  453. end
  454. end
  455. part29 = Instance.new("Part",part)
  456. part29.CanCollide = false
  457. part29.Transparency = 1
  458. part30 = Instance.new("Part",part)
  459. part30.CanCollide = false
  460. part30.Transparency = 1
  461. local ats = Instance.new("Attachment",part)
  462. ats.CFrame = CFrame.new(3,0,-4.325) * CFrame.Angles(0,math.rad(90),math.rad(90))
  463. local ats2 = Instance.new("Attachment",part29)
  464. ats2.CFrame = CFrame.new(0,1,0) * CFrame.Angles(0,math.rad(90),math.rad(90))
  465. part29.CFrame = part.CFrame * ats.CFrame
  466. steer = Instance.new("HingeConstraint")
  467. steer.Parent = part
  468. steer.ActuatorType = "Servo"
  469. steer.TargetAngle = 0
  470. steer.ServoMaxTorque = 10000000000000000
  471. steer.AngularSpeed = 100000000000000
  472. steer.Attachment0 = ats
  473. steer.Attachment1 = ats2
  474. part30 = Instance.new("Part",part)
  475. part30.CanCollide = false
  476. local off = true
  477. part30.Transparency = 1
  478. owner.Character.Head.CFrame = owner.Character.Head.CFrame * CFrame.new(0,0,2)
  479. local ats3 = Instance.new("Attachment",part)
  480. ats3.CFrame = CFrame.new(-3,0,-4.325) * CFrame.Angles(0,math.rad(90),math.rad(90))
  481. local ats4 = Instance.new("Attachment",part30)
  482. ats4.CFrame = CFrame.new(0,1,0) * CFrame.Angles(0,math.rad(90),math.rad(90))
  483. part30.CFrame = part.CFrame * ats3.CFrame
  484. steer2 = Instance.new("HingeConstraint")
  485. steer2.Parent = part
  486. steer2.ActuatorType = "Servo"
  487. steer2.TargetAngle = 0
  488. steer2.ServoMaxTorque = 10000000000000000
  489. steer2.AngularSpeed = 100000000000000
  490. steer2.Attachment0 = ats3
  491. steer2.Attachment1 = ats4
  492. for i,v in pairs(script:GetChildren()) do
  493. if v ~= part then
  494. local wel = Instance.new("WeldConstraint",part)
  495. wel.Part0 = v
  496. wel.Part1 = part
  497. v.Anchored = false
  498. v.Transparency = 1
  499. PhysicsService:SetPartCollisionGroup(v, car)
  500. v.Locked = true
  501. end
  502. end
  503. wait()
  504. part.Transparency = 1
  505. part.Locked = true
  506. part31.Material = "Plastic"
  507. part.CanCollide = false
  508. part31.Transparency = 0
  509. parts.Transparency = 0
  510. parts2.Transparency = 0
  511. part34.Transparency = 0
  512. part35.Transparency = 0
  513. PhysicsService:SetPartCollisionGroup(part, car)
  514. local mot1 = suspension(part29,CFrame.new(0,-0.5,0) * CFrame.Angles(0,math.rad(0),0),false,"Back")
  515. local mot2 = suspension(part31,CFrame.new(-1.5,2.5,-7.85) * CFrame.Angles(0,math.rad(90),0),true,"Back")
  516. local mot3 = suspension(part30,CFrame.new(0,-0.5,0) * CFrame.Angles(0,math.rad(180),0),false,"Front")
  517. local mot4 = suspension(part31,CFrame.new(-1.5,2.5,7.85) * CFrame.Angles(0,math.rad(270),0),true,"Front")
  518. mot1.AngularVelocity = 0
  519. mot2.AngularVelocity = 0
  520. mot3.AngularVelocity = 0
  521. mot4.AngularVelocity = 0
  522. wait(0.25)
  523. PhysicsService:CollisionGroupSetCollidable(car, wheels, false)
  524. wait(0.1)
  525. part.Anchored = false
  526. local speed = 0
  527. local throt = false
  528. local mod = nil
  529. prox = Instance.new("ProximityPrompt",part)
  530. prox.RequiresLineOfSight = false
  531. prox.Style = Enum.ProximityPromptStyle.Custom
  532. prox2 = Instance.new("ProximityPrompt",part)
  533. prox2.RequiresLineOfSight = false
  534. prox2.Style = Enum.ProximityPromptStyle.Custom
  535. prox2.KeyboardKeyCode = Enum.KeyCode.H
  536. prox.Triggered:Connect(function(player)
  537. if player.Character == mod then
  538. headlights()
  539. end
  540. end)
  541. prox3 = Instance.new("ProximityPrompt",part)
  542. prox3.RequiresLineOfSight = false
  543. prox3.Style = Enum.ProximityPromptStyle.Custom
  544. prox3.KeyboardKeyCode = Enum.KeyCode.G
  545. local starting = false
  546. prox3.Triggered:Connect(function(player)
  547. if player.Character == mod then
  548. if off and not starting then
  549. start.Volume = 2
  550. start.SoundId = "rbxassetid://9075587875"
  551. starting = true
  552. start:Play()
  553. tween:Play()
  554. tween.Completed:Wait()
  555. off = false
  556. starting = false
  557. elseif not off and not starting then
  558. start.Volume = 3
  559. start.SoundId = "rbxassetid://4655463946"
  560. off = true
  561. start:Play()
  562. end
  563. end
  564. end)
  565. honking = false
  566. music = Instance.new("Sound",part)
  567. music.Pitch = 0
  568. music.Volume = 0.65
  569. local musics = {"1838857104","1835495895","9047888542","1835495943","9047908120"}
  570. music.SoundId = "rbxassetid://" .. musics[math.random(1, #musics)]
  571.  
  572. music.Ended:Connect(function(SoundId)
  573. local newSoundId
  574.  
  575. do repeat
  576. newSoundId = "rbxassetid://" .. musics[math.random(1, #musics)]
  577. wait()
  578. until
  579. newSoundId ~= SoundId
  580. end
  581.  
  582. music:Stop()
  583. music.SoundId = newSoundId
  584. music.TimePosition = 0
  585. task.wait()
  586. music:Play()
  587. end)
  588. music:Play()
  589. local honks = Instance.new("Sound",part)
  590. honks.SoundId = "rbxassetid://7817329753"
  591. honks.Looped = true
  592. honks.Volume = 0
  593. function honk(what)
  594. if what == true then
  595. honks:Play()
  596. honking = true
  597. coroutine.wrap(function()
  598. for i = 1,3 do
  599. if not honking then break end
  600. wait(0.00125)
  601. honks.Volume = math.clamp(honks.Volume + 0.666666666667,0,2)
  602. end
  603. end)()
  604. elseif what == false then
  605. honking = false
  606. for i = 1,3 do
  607. if honking then break end
  608. wait(0.00125)
  609. honks.Volume = math.clamp(honks.Volume - 0.666666666667,0,2)
  610. end
  611. honks:Stop()
  612. end
  613. end
  614. prox2.Triggered:Connect(function(player)
  615. if player.Character == mod then
  616. honk(true)
  617. end
  618. end)
  619. prox2.TriggerEnded:Connect(function(player)
  620. if player.Character == mod then
  621. honk(false)
  622. end
  623. end)
  624. part:GetPropertyChangedSignal("Occupant"):Connect(function()
  625. if part.Occupant ~= nil then
  626. local Model = part.Occupant:FindFirstAncestorOfClass("Model")
  627. if Model then
  628. mod = Model
  629. else
  630. mod = nil
  631. end
  632. else
  633. task.wait()
  634. mod.PrimaryPart.CFrame = mod.PrimaryPart.CFrame * CFrame.new(8,0,0)
  635. mod = nil
  636. end
  637. end)
  638. local currentthrot = 0
  639. local function carMove(property)
  640. if property == "ThrottleFloat" then
  641. if part.ThrottleFloat ~= 0 then
  642. currentthrot = part.ThrottleFloat
  643. throt = true
  644. else
  645. currentthrot = 0
  646. throt = false
  647. end
  648. end
  649. end
  650. lastthrot = 0
  651.  
  652. part.Changed:Connect(carMove)
  653. coroutine.wrap(function()
  654. while task.wait() do
  655. if not off then
  656. steer.TargetAngle = 27.5 * -part.SteerFloat
  657. steer2.TargetAngle = 27.5 * -part.SteerFloat
  658. sound.Pitch = math.clamp((part.ThrottleFloat * speed) * 0.0425,0,1.1125)
  659. sound.PlaybackSpeed = math.clamp((part.ThrottleFloat * speed) * 0.0425,0,1.1125)
  660. sound.Volume = math.clamp(sound.Volume + 0.1,0,1.5)
  661. music.Pitch = math.clamp(music.Pitch + 0.05,0,1)
  662. idle.Volume = math.clamp(idle.Volume + 0.01,0,0.25)
  663. else
  664. steer.TargetAngle = 0
  665. steer2.TargetAngle = 0
  666. sound.Pitch = math.clamp(sound.Pitch - 0.025,0,1.1125)
  667. sound.PlaybackSpeed = math.clamp(sound.PlaybackSpeed - 0.025,0,1.1125)
  668. sound.Volume = math.clamp(sound.Volume - 0.025,0,1.5)
  669. idle.Volume = math.clamp(idle.Volume - 0.005,0,0.25)
  670. music.Pitch = math.clamp(music.Pitch - 0.01,0,1)
  671. end
  672. end
  673. end)()
  674. local reverse = false
  675. while task.wait() do
  676. if throt and math.clamp(currentthrot * math.huge,-1,1) ~= -lastthrot and not off then
  677. lastthrot = part.Throttle
  678. lights(false)
  679. wait(0.0525)
  680. speed = math.clamp(speed + 0.75,0,45)
  681. mot1.AngularVelocity = part.ThrottleFloat * speed
  682. mot2.AngularVelocity = part.ThrottleFloat * speed
  683. mot3.AngularVelocity = -part.ThrottleFloat * speed
  684. mot4.AngularVelocity = -part.ThrottleFloat * speed
  685. elseif throt and math.clamp(currentthrot * math.huge,-1,1) == -lastthrot and not off then
  686. lights(true)
  687. for i = 1, 35 do
  688. wait(0.0525)
  689. speed = math.clamp(speed - (1),0,45)
  690. mot1.AngularVelocity = lastthrot * speed
  691. mot2.AngularVelocity = lastthrot * speed
  692. mot3.AngularVelocity = -lastthrot * speed
  693. mot4.AngularVelocity = -lastthrot * speed
  694. if speed == 0 then
  695. lastthrot = part.Throttle
  696. if speed == 0 then break end
  697. end
  698. end
  699. elseif not throt or off then
  700. if speed ~= 0 then
  701. lights(true)
  702. wait(0.0325)
  703. else
  704. lights(false)
  705. end
  706. speed = math.clamp(speed - (0.75),0,45)
  707. mot1.AngularVelocity = lastthrot * speed
  708. mot2.AngularVelocity = lastthrot * speed
  709. mot3.AngularVelocity = -lastthrot * speed
  710. mot4.AngularVelocity = -lastthrot * speed
  711. end
  712. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement