TheUnknownDiscord

car template remake

Oct 14th, 2021 (edited)
98
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. script.Parent = owner.Character
  2. Seat = Instance.new("VehicleSeat")
  3. Seat.Parent = script
  4. Seat.Size = Vector3.new(4,1,10)
  5. Seat.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.new(0,8,-8.057)
  6. Seat.TopSurface = Enum.SurfaceType.Smooth
  7. Seat.BottomSurface = Enum.SurfaceType.Smooth
  8. Bumper = Instance.new("Part")
  9. Bumper.Parent = script
  10. Bumper.Size = Vector3.new(7.75,2.25,1)
  11. Weldlol3 = Instance.new("Weld")
  12. Weldlol3.Parent = Seat
  13. Weldlol3.Part0 = Seat
  14. Weldlol3.Part1 = Bumper
  15. Weldlol3.C1 = Weldlol3.C1 * CFrame.new(0,-1.25,9.75)
  16. side = Instance.new("Part")
  17. side.Parent = script
  18. side.Size = Vector3.new(1.75,0.25,17.15)
  19. Weldside = Instance.new("Weld")
  20. Weldside.Parent = Seat
  21. Weldside.Part0 = Seat
  22. Weldside.Part1 = side
  23. Weldside.C1 = Weldside.C1 * CFrame.new(3.0625,-2.25,0.625)
  24. side2 = Instance.new("Part")
  25. side2.Parent = script
  26. side2.Size = Vector3.new(1.75,0.25,17.15)
  27. Weldside2 = Instance.new("Weld")
  28. Weldside2.Parent = Seat
  29. Weldside2.Part0 = Seat
  30. Weldside2.Part1 = side2
  31. Weldside2.C1 = Weldside2.C1 * CFrame.new(-3.0625,-2.25,0.625)
  32. Bumper3 = Instance.new("Part")
  33. Bumper3.Parent = script
  34. Bumper3.Size = Vector3.new(4,2.25,4.65)
  35. Weldlol32 = Instance.new("Weld")
  36. Weldlol32.Parent = Bumper
  37. Weldlol32.Part0 = Bumper
  38. Weldlol32.Part1 = Bumper3
  39. Weldlol32.C1 = Weldlol32.C1 * CFrame.new(0,0,-2.5)
  40. Bumper2 = Instance.new("Part")
  41. Bumper2.Parent = script
  42. Bumper2.Size = Vector3.new(7.75,2.25,1)
  43. Weldlol31 = Instance.new("Weld")
  44. Weldlol31.Parent = Seat
  45. Weldlol31.Part0 = Seat
  46. Weldlol31.Part1 = Bumper2
  47. Weldlol31.C1 = Weldlol31.C1 * CFrame.new(0,-1.25,-8.5)
  48. Bumper4 = Instance.new("Part")
  49. Bumper4.Parent = script
  50. Bumper4.Size = Vector3.new(4,2.25,4.65)
  51. Weldlol33 = Instance.new("Weld")
  52. Weldlol33.Parent = Bumper2
  53. Weldlol33.Part0 = Bumper2
  54. Weldlol33.Part1 = Bumper4
  55. Weldlol33.C1 = Weldlol33.C1 * CFrame.new(0,0,2.5)
  56. wheel = Instance.new("Part")
  57. wheel.Parent = Seat
  58. wheel.Size = Vector3.new(1,3,3)
  59. steer = Instance.new("Part")
  60. steer.Parent = Seat
  61. steer.Size = Vector3.new(1,1,1)
  62. steer2 = Instance.new("Part")
  63. steer2.Parent = Seat
  64. steer2.Size = Vector3.new(1,1,1)
  65. steer.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.new(-3.739,1,-7.25)
  66. steer2.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.new(3.739,1,-7.25)
  67. steer.Transparency = 1
  68. steer.CanCollide = false
  69. steer2.Transparency = 1
  70. steer2.CanCollide = false
  71. wheelsus = Instance.new("Part")
  72. wheelsus.Parent = Seat
  73. wheelsus.Size = Vector3.new(1,1,1)
  74. wheelsus2 = Instance.new("Part")
  75. wheelsus2.Parent = Seat
  76. wheelsus2.Size = Vector3.new(1,1,1)
  77. wheelsus.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.new(-3.739,1,-7.25)
  78. wheelsus2.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.new(3.739,1,-7.25)
  79. wheelsus.Transparency = 1
  80. wheelsus.CanCollide = false
  81. wheelsus2.Transparency = 1
  82. wheelsus2.CanCollide = false
  83. Seat.Anchored = true
  84. wheel.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.new(-3.739,6.5,-7.25)
  85. wheel.TopSurface = Enum.SurfaceType.Smooth
  86. wheel.BottomSurface = Enum.SurfaceType.Smooth
  87. wheel2 = Instance.new("Part")
  88. wheel2.Parent = Seat
  89. wheel2.Size = Vector3.new(1,3,3)
  90. wheel2.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.new(3.739,6.5,-7.25)
  91. wheel2.TopSurface = Enum.SurfaceType.Smooth
  92. wheel2.BottomSurface = Enum.SurfaceType.Smooth
  93. wheel3 = Instance.new("Part")
  94. wheel3.Parent = Seat
  95. wheel3.Size = Vector3.new(1,3,3)
  96. wheel3.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.new(-3.739,6.5,5.75)
  97. wheel3.TopSurface = Enum.SurfaceType.Smooth
  98. wheel3.BottomSurface = Enum.SurfaceType.Smooth
  99. wheel4 = Instance.new("Part")
  100. wheel4.Parent = Seat
  101. wheel4.Size = Vector3.new(1,3,3)
  102. wheel4.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.new(3.739,6.5,5.75)
  103. wheel4.TopSurface = Enum.SurfaceType.Smooth
  104. wheel4.BottomSurface = Enum.SurfaceType.Smooth
  105. wheel.Shape = Enum.PartType.Cylinder
  106. wheel2.Shape = Enum.PartType.Cylinder
  107. wheel3.Shape = Enum.PartType.Cylinder
  108. wheel4.Shape = Enum.PartType.Cylinder
  109. local attachment0 = Instance.new("Attachment")
  110. attachment0.Parent = steer
  111. local attachment1 = Instance.new("Attachment")
  112. attachment1.Parent = Seat
  113. alignposition = Instance.new("HingeConstraint")
  114. alignposition.Parent = Seat
  115. alignposition.ActuatorType = "Servo"
  116. alignposition.TargetAngle = 0
  117. alignposition.Name = "Hinge4"
  118. alignposition.ServoMaxTorque = 10000000
  119. alignposition.AngularSpeed = 10000000
  120. alignposition.Attachment0 = attachment0
  121. alignposition.Attachment1 = attachment1
  122. attachment1.WorldCFrame = attachment1.Parent.CFrame * CFrame.new(-3.739,1,-7.25) * CFrame.Angles(0,math.rad(180),math.rad(90))
  123. local attachment02 = Instance.new("Attachment")
  124. attachment02.Parent = steer2
  125. local attachment12 = Instance.new("Attachment")
  126. attachment12.Parent = Seat
  127. alignposition2 = Instance.new("HingeConstraint")
  128. alignposition2.Parent = Seat
  129. alignposition2.ActuatorType = "Servo"
  130. alignposition2.TargetAngle = 0
  131. alignposition2.Name = "Hinge3"
  132. alignposition2.ServoMaxTorque = 10000000
  133. alignposition2.AngularSpeed = 10000000
  134. alignposition2.Attachment0 = attachment02
  135. alignposition2.Attachment1 = attachment12
  136. attachment12.WorldCFrame = attachment12.Parent.CFrame * CFrame.new(3.739,1,-7.25) * CFrame.Angles(0,0,math.rad(90))
  137. task.wait()
  138. local attachment031 = Instance.new("Attachment")
  139. attachment031.Parent = wheel
  140. local attachment131 = Instance.new("Attachment")
  141. attachment131.Parent = wheelsus
  142. alignposition31 = Instance.new("HingeConstraint")
  143. alignposition31.Parent = Seat
  144. alignposition31.ActuatorType = Enum.ActuatorType.None
  145. alignposition31.Attachment0 = attachment031
  146. alignposition31.Attachment1 = attachment131
  147. local attachment0231 = Instance.new("Attachment")
  148. attachment0231.Parent = wheel2
  149. local attachment1231 = Instance.new("Attachment")
  150. attachment1231.Parent = wheelsus2
  151. alignposition231 = Instance.new("HingeConstraint")
  152. alignposition231.Parent = Seat
  153. alignposition231.ActuatorType = Enum.ActuatorType.None
  154. alignposition231.Attachment0 = attachment0231
  155. alignposition231.Attachment1 = attachment1231
  156. local attachment03 = Instance.new("Attachment")
  157. attachment03.Parent = wheel3
  158. local attachment13 = Instance.new("Attachment")
  159. attachment13.Parent = Seat
  160. alignposition3 = Instance.new("HingeConstraint")
  161. alignposition3.Parent = Seat
  162. alignposition3.ActuatorType = "Motor"
  163. alignposition3.MotorMaxAcceleration = 10000000
  164. alignposition3.MotorMaxTorque = 10000000
  165. alignposition3.Name = "Hinge1"
  166. alignposition3.Attachment0 = attachment03
  167. alignposition3.Attachment1 = attachment13
  168. attachment13.WorldCFrame = attachment13.Parent.CFrame * CFrame.new(-3.739,0,5.75)* CFrame.Angles(0,math.rad(180),0)
  169. local attachment023 = Instance.new("Attachment")
  170. attachment023.Parent = wheel4
  171. local attachment123 = Instance.new("Attachment")
  172. attachment123.Parent = Seat
  173. alignposition23 = Instance.new("HingeConstraint")
  174. alignposition23.Parent = Seat
  175. alignposition23.ActuatorType = "Motor"
  176. alignposition23.MotorMaxAcceleration = 10000000
  177. alignposition23.MotorMaxTorque = 10000000
  178. alignposition23.Name = "Hinge2"
  179. alignposition23.Attachment0 = attachment023
  180. alignposition23.Attachment1 = attachment123
  181. attachment123.WorldCFrame = attachment123.Parent.CFrame * CFrame.new(3.739,0,5.75)
  182. local motor1 = alignposition3
  183. local motor2 = alignposition23
  184. local steerServo = alignposition
  185. local steerServo2 = alignposition2
  186. local maxSpeed = 42.5
  187. local angleSteer = 27.5
  188. local function carMove(property)
  189. if property == "Throttle" then
  190. alignposition23.AngularVelocity = Seat.Throttle * maxSpeed
  191. alignposition3.AngularVelocity = Seat.Throttle * -maxSpeed
  192. elseif property == "Steer" then
  193. alignposition.TargetAngle = angleSteer * Seat.Steer
  194. alignposition2.TargetAngle = angleSteer * Seat.Steer
  195. end
  196. end
  197. Seat.Changed:Connect(carMove)
  198. local density = 1
  199. local friction = 1
  200. local elasticity = 0
  201. local frictionWeight = 100000000000
  202. local elasticityWeight = 0
  203. local physProperties = PhysicalProperties.new(density, friction, elasticity, frictionWeight, elasticityWeight)
  204. Seat.CustomPhysicalProperties = physProperties
  205. wheel.CustomPhysicalProperties = physProperties
  206. wheel2.CustomPhysicalProperties = physProperties
  207. wheel3.CustomPhysicalProperties = physProperties
  208. wheel4.CustomPhysicalProperties = physProperties
  209. wait(0.25)
  210. Seat.Anchored = false
  211. Mesh2 = Instance.new("SpecialMesh")
  212. Mesh2.Parent = wheel
  213. Mesh2.MeshId = "http://www.roblox.com/asset/?id=439151274"
  214. Mesh2.TextureId = "http://www.roblox.com/asset/?id=1110514085"
  215. Mesh2.Scale = Vector3.new(0.045,0.045,0.045)
  216. Mesh3 = Instance.new("SpecialMesh")
  217. Mesh3.Parent = wheel2
  218. Mesh3.MeshId = "http://www.roblox.com/asset/?id=439151274"
  219. Mesh3.TextureId = "http://www.roblox.com/asset/?id=1110514085"
  220. Mesh3.Scale = Vector3.new(0.045,0.045,0.045)
  221. Mesh4 = Instance.new("SpecialMesh")
  222. Mesh4.Parent = wheel3
  223. Mesh4.MeshId = "http://www.roblox.com/asset/?id=439151274"
  224. Mesh4.TextureId = "http://www.roblox.com/asset/?id=1110514085"
  225. Mesh4.Scale = Vector3.new(0.045,0.045,0.045)
  226. Mesh5 = Instance.new("SpecialMesh")
  227. Mesh5.Parent = wheel4
  228. Mesh5.MeshId = "http://www.roblox.com/asset/?id=439151274"
  229. Mesh5.TextureId = "http://www.roblox.com/asset/?id=1110514085"
  230. Mesh5.Scale = Vector3.new(0.045, 0.045, 0.045)
  231. local carHealth = 125
  232. times = 0
  233. function byecar()
  234. times = times + 1
  235. if times == 1 then
  236. leftpart = Instance.new("Part", Seat)
  237. leftpart.Transparency = 1
  238. leftpart.Anchored = true
  239. leftpart.CanCollide = false
  240. leftpart.CFrame = Seat.CFrame
  241. leftpart.Name = "soundpart"
  242. local goodbye = Instance.new("Sound", leftpart)
  243. goodbye.SoundId = "rbxassetid://4407929531"
  244. local windows = Instance.new("Sound", leftpart)
  245. windows.SoundId = "rbxassetid://5994223709"
  246. windows.Volume = 1.5
  247. goodbye.Volume = 1.5
  248. goodbye:Play()
  249. task.wait()
  250. goodbye.Ended:Wait()
  251. windows:Play()
  252. task.wait()
  253. for i,v in pairs(script:GetDescendants()) do
  254. if v:IsA("BasePart") or v:IsA("VehicleSeat") then
  255. local tweenService = game:GetService("TweenService")
  256.  
  257. local timeToFade = windows.TimeLength * 0.5
  258. local object = v
  259. local tweenInfo = TweenInfo.new(timeToFade)
  260. local goal = {}
  261. goal.Transparency = 1
  262.  
  263. local tween = tweenService:Create(object, tweenInfo, goal)
  264. tween:Play()
  265. end
  266. end
  267. task.wait()
  268. wait(windows.TimeLength * 0.5)
  269. for i,v in pairs(script:GetDescendants()) do
  270. if v:IsA("BasePart") or v:IsA("VehicleSeat") and v.Name ~= "soundpart" then
  271. v:Destroy()
  272. end
  273. end
  274. windows.Ended:Wait()
  275. goodbye:Destroy()
  276. windows:Destroy()
  277. leftpart:Destroy()
  278. end
  279. end
  280. Bumper.Touched:Connect(function(Hit)
  281.  
  282. local Speed = math.floor((Bumper.Velocity - Hit.Velocity).magnitude)
  283.  
  284. if Speed > 30 and not game.Players:GetPlayerFromCharacter(Hit.Parent) and not Hit.CanCollide == false then
  285.  
  286. carHealth = carHealth - Bumper.Velocity.Magnitude / 1.06
  287.  
  288. end
  289.  
  290. if carHealth <= 10 then
  291. Seat.Disabled = true
  292. byecar()
  293. end
  294. end)
  295.  
  296. Bumper2.Touched:Connect(function(Hit)
  297.  
  298. local Speed = math.floor((Bumper2.Velocity - Hit.Velocity).magnitude)
  299.  
  300. if Speed > 30 and not game.Players:GetPlayerFromCharacter(Hit.Parent) and not Hit.CanCollide == false then
  301.  
  302. carHealth = carHealth - Bumper2.Velocity.Magnitude / 1.06
  303.  
  304. end
  305. if carHealth <= 10 then
  306. Seat.Disabled = true
  307. byecar()
  308. end
  309. end)
  310. for i,v in pairs(script:GetDescendants()) do
  311. if v:IsA("BasePart") or v:IsA("VehicleSeat") then
  312. v.TopSurface = Enum.SurfaceType.Smooth
  313. v.BottomSurface = Enum.SurfaceType.Smooth
  314. end
  315. end
  316. E = Instance.new("RemoteEvent", owner.Character)
  317. E.Name = "the"
  318. function lightslol(plr, action)
  319. if plr == Seat.Occupant then
  320. if action == "Lights" then
  321. print("on")
  322. elseif action == "off" then
  323. print("off")
  324. end
  325. end
  326. end
  327. local lightsnls = NLS([[
  328. E = owner.Character:WaitForChild("the")
  329. local mouse
  330. script.AncestryChanged:Connect(function()
  331. local mouse = script.Parent.Parent:GetMouse()
  332. end)
  333. local count = 0
  334. mouse.KeyDown:connect(function(key)
  335. key = key:lower()
  336. if key == "l" then
  337. count = count + 1
  338. if count == 1 then
  339. E:FireServer("Lights")
  340. elseif count == 2 then
  341. E:FireServer("off")
  342. task.wait()
  343. count = 0
  344. end
  345. end
  346. end)
  347. task.wait()
  348. script.Parent = owner.PlayerGui
  349. ]],owner.PlayerGui)
  350. wait(0.1)
  351. lightsnls.Parent = owner.PlayerGui
  352. E.OnServerEvent:Connect(lightslol)
  353. Seat.ChildAdded:connect(function()
  354. local plr = game.Players:GetPlayerFromCharacter(Seat.Occupant.Parent)
  355. local screengui = Instance.new("ScreenGui", plr:findFirstChildOfClass("PlayerGui"))
  356. screengui.ResetOnSpawn = true
  357. screengui.Name = "youfailed"
  358. local tl = Instance.new("TextLabel", screengui)
  359. tl.Size = UDim2.new(1,0,1,0)
  360. tl.AnchorPoint = Vector2.new(0.5, 0.5)
  361. tl.Position = UDim2.new(0.5, 0, 0.5, 0)
  362. tl.Text = "The local script is controls for car lights"
  363. tl.BackgroundTransparency = 1
  364. tl.TextTransparency = 0
  365. tl.TextColor3 = Color3.new(1, 1, 1)
  366. tl.TextSize = 50
  367. lightsnls.Parent = plr.PlayerGui
  368. wait(2.5)
  369. screengui:Destroy()
  370. end)
  371. local at0 = Instance.new("Attachment" , steer)
  372. at0.CFrame = CFrame.Angles(0,0,math.rad(-90))
  373. local at1 = Instance.new("Attachment" , wheelsus)
  374. at1.CFrame = CFrame.Angles(0,0,math.rad(-90))
  375. local spring = Instance.new("SpringConstraint" , steer)
  376. spring.Attachment0 = at0
  377. spring.Attachment1 = at1
  378. spring.Stiffness = 700
  379. spring.Damping = 200
  380. spring.FreeLength = 8
  381. spring.LimitsEnabled = true
  382. spring.MaxForce = 10000
  383. spring.MaxLength = 15
  384. spring.MinLength = 2
  385. spring.Enabled = true
  386. spring.Visible = true
  387. local prism = Instance.new("PrismaticConstraint" , steer)
  388. prism.Attachment0 = at0
  389. prism.Attachment1 = at1
  390. local at2 = Instance.new("Attachment" , steer2)
  391. at2.CFrame = CFrame.Angles(0,0,math.rad(-90))
  392. local at3 = Instance.new("Attachment" , wheelsus2)
  393. at3.CFrame = CFrame.Angles(0,0,math.rad(-90))
  394. local spring2 = Instance.new("SpringConstraint" , steer2)
  395. spring2.Attachment0 = at3
  396. spring2.Attachment1 = at4
  397. spring2.Stiffness = 700
  398. spring2.Damping = 200
  399. spring2.FreeLength = 8
  400. spring2.LimitsEnabled = true
  401. spring2.MaxForce = 10000
  402. spring2.MaxLength = 15
  403. spring2.MinLength = 2
  404. spring2.Enabled = true
  405. spring2.Visible = true
  406. local prism2 = Instance.new("PrismaticConstraint" , steer2)
  407. prism2.Attachment0 = at3
  408. prism2.Attachment1 = at4
  409. at4.WorldCFrame = at4.Parent.CFrame * CFrame.new(-1,0,0) * CFrame.Angles(0,0,math.rad(-90))
  410. at3.WorldCFrame = at3.Parent.CFrame * CFrame.new(-1,0,0) * CFrame.Angles(0,0,math.rad(-90))
  411. at1.WorldCFrame = at1.Parent.CFrame * CFrame.new(-1,0,0) * CFrame.Angles(0,0,math.rad(-90))
  412. at2.WorldCFrame = at2.Parent.CFrame * CFrame.new(-1,0,0) * CFrame.Angles(0,0,math.rad(-90))
RAW Paste Data