TheUnknownDiscord

truck

Oct 14th, 2021 (edited)
82
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. carmodel = Instance.new("Model", script)
  2. carmodel.Name = "Trucc"
  3. Seat = Instance.new("VehicleSeat")
  4. Seat.Parent = carmodel
  5. Seat.Size = Vector3.new(4,1,10)
  6. Seat.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.new(0,8,-8.057)
  7. Seat.TopSurface = Enum.SurfaceType.Smooth
  8. Seat.BottomSurface = Enum.SurfaceType.Smooth
  9. carmodel.PrimaryPart = Seat
  10. Bumper = Instance.new("Part")
  11. Bumper.Parent = carmodel
  12. Bumper.Size = Vector3.new(7.75,2.25,1)
  13. Weldlol3 = Instance.new("Weld")
  14. Weldlol3.Parent = Seat
  15. Weldlol3.Part0 = Seat
  16. Weldlol3.Part1 = Bumper
  17. Weldlol3.C1 = Weldlol3.C1 * CFrame.new(0,-1.25,9.65)
  18. Bumper3 = Instance.new("Part")
  19. Bumper3.Parent = carmodel
  20. Bumper3.Size = Vector3.new(4,2.25,4.65)
  21. Weldlol32 = Instance.new("Weld")
  22. Weldlol32.Parent = Bumper
  23. Weldlol32.Part0 = Bumper
  24. Weldlol32.Part1 = Bumper3
  25. Weldlol32.C1 = Weldlol32.C1 * CFrame.new(0,0,-2.5)
  26. Seatlol = Instance.new("Seat")
  27. Seatlol.Parent = carmodel
  28. Seatlol.Size = Vector3.new(7,1,2)
  29. seatweld = Instance.new("Weld")
  30. seatweld.Parent = Seat
  31. seatweld.Part0 = Seat
  32. seatweld.Part1 = Seatlol
  33. seatweld.C1 = seatweld.C1 * CFrame.new(0,-0.75,1.75) * CFrame.Angles(0,math.rad(180),0)
  34. Bumper2 = Instance.new("Part")
  35. Bumper2.Parent = carmodel
  36. Bumper2.Size = Vector3.new(7.75,2.25,1)
  37. Weldlol31 = Instance.new("Weld")
  38. Weldlol31.Parent = Seat
  39. Weldlol31.Part0 = Seat
  40. Weldlol31.Part1 = Bumper2
  41. Weldlol31.C1 = Weldlol31.C1 * CFrame.new(0,-1.25,-10.5)
  42. wheel = Instance.new("Part")
  43. wheel.Parent = Seat
  44. wheel.Size = Vector3.new(1,3,3)
  45. steer = Instance.new("Part")
  46. steer.Parent = Seat
  47. steer.Size = Vector3.new(1,1,1)
  48. steer2 = Instance.new("Part")
  49. steer2.Parent = Seat
  50. steer2.Size = Vector3.new(1,1,1)
  51. steer.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.new(-3.739,1,-7.25)
  52. steer2.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.new(3.739,1,-7.25)
  53. steer.Transparency = 1
  54. steer.CanCollide = false
  55. steer2.Transparency = 1
  56. steer2.CanCollide = false
  57. Seat.Anchored = true
  58. wheel.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.new(-3.739,6.5,-7.25)
  59. wheel.TopSurface = Enum.SurfaceType.Smooth
  60. wheel.BottomSurface = Enum.SurfaceType.Smooth
  61. wheel2 = Instance.new("Part")
  62. wheel2.Parent = Seat
  63. wheel2.Size = Vector3.new(1,3,3)
  64. wheel2.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.new(3.739,6.5,-7.25)
  65. wheel2.TopSurface = Enum.SurfaceType.Smooth
  66. wheel2.BottomSurface = Enum.SurfaceType.Smooth
  67. wheel3 = Instance.new("Part")
  68. wheel3.Parent = Seat
  69. wheel3.Size = Vector3.new(1,3,3)
  70. wheel3.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.new(-3.739,6.5,5.75)
  71. wheel3.TopSurface = Enum.SurfaceType.Smooth
  72. wheel3.BottomSurface = Enum.SurfaceType.Smooth
  73. wheel4 = Instance.new("Part")
  74. wheel4.Parent = Seat
  75. wheel4.Size = Vector3.new(1,3,3)
  76. wheel4.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.new(3.739,6.5,5.75)
  77. wheel4.TopSurface = Enum.SurfaceType.Smooth
  78. wheel4.BottomSurface = Enum.SurfaceType.Smooth
  79. wheel.Shape = Enum.PartType.Cylinder
  80. wheel2.Shape = Enum.PartType.Cylinder
  81. wheel3.Shape = Enum.PartType.Cylinder
  82. wheel4.Shape = Enum.PartType.Cylinder
  83. Mesh = Instance.new("SpecialMesh")
  84. Mesh.Parent = Seat
  85. Mesh.MeshId = "http://www.roblox.com/asset/?id=7408695235"
  86. Mesh.TextureId = "http://www.roblox.com/asset/?id=7408695426"
  87. Mesh.Scale = Vector3.new(5, 5, 5)
  88. Mesh.Offset = Vector3.new(0, 2.75, 0.45)
  89. Bumper.Transparency = 1
  90. Bumper2.Transparency = 1
  91. Bumper3.Transparency = 1
  92. local attachment0 = Instance.new("Attachment")
  93. attachment0.Parent = steer
  94. local attachment1 = Instance.new("Attachment")
  95. attachment1.Parent = Seat
  96. alignposition = Instance.new("HingeConstraint")
  97. alignposition.Parent = Seat
  98. alignposition.ActuatorType = "Servo"
  99. alignposition.TargetAngle = 0
  100. alignposition.Name = "Hinge4"
  101. alignposition.ServoMaxTorque = 100000000000
  102. alignposition.AngularSpeed = 100000000000
  103. alignposition.Attachment0 = attachment0
  104. alignposition.Attachment1 = attachment1
  105. attachment1.WorldCFrame = attachment1.Parent.CFrame * CFrame.new(-3.739,1,-7) * CFrame.Angles(0,math.rad(180),math.rad(90))
  106. local attachment02 = Instance.new("Attachment")
  107. attachment02.Parent = steer2
  108. local attachment12 = Instance.new("Attachment")
  109. attachment12.Parent = Seat
  110. alignposition2 = Instance.new("HingeConstraint")
  111. alignposition2.Parent = Seat
  112. alignposition2.ActuatorType = "Servo"
  113. alignposition2.TargetAngle = 0
  114. alignposition2.Name = "Hinge3"
  115. alignposition2.ServoMaxTorque = 100000000000
  116. alignposition2.AngularSpeed = 100000000000
  117. alignposition2.Attachment0 = attachment02
  118. alignposition2.Attachment1 = attachment12
  119. attachment12.WorldCFrame = attachment12.Parent.CFrame * CFrame.new(3.739,1,-7) * CFrame.Angles(0,0,math.rad(90))
  120. task.wait()
  121. local attachment031 = Instance.new("Attachment")
  122. attachment031.Parent = wheel
  123. local attachment131 = Instance.new("Attachment")
  124. attachment131.Parent = steer
  125. alignposition31 = Instance.new("HingeConstraint")
  126. alignposition31.Parent = Seat
  127. alignposition31.ActuatorType = Enum.ActuatorType.None
  128. alignposition31.Attachment0 = attachment031
  129. alignposition31.Attachment1 = attachment131
  130. attachment131.WorldCFrame = attachment131.Parent.CFrame * CFrame.new(-1.5,0,0) * CFrame.Angles(0,0,math.rad(-90))
  131. local attachment0231 = Instance.new("Attachment")
  132. attachment0231.Parent = wheel2
  133. local attachment1231 = Instance.new("Attachment")
  134. attachment1231.Parent = steer2
  135. alignposition231 = Instance.new("HingeConstraint")
  136. alignposition231.Parent = Seat
  137. alignposition231.ActuatorType = Enum.ActuatorType.None
  138. alignposition231.Attachment0 = attachment0231
  139. alignposition231.Attachment1 = attachment1231
  140. attachment1231.WorldCFrame = attachment1231.Parent.CFrame * CFrame.new(-1.5,0,0) * CFrame.Angles(0,0,math.rad(-90))
  141. local attachment03 = Instance.new("Attachment")
  142. attachment03.Parent = wheel3
  143. local attachment13 = Instance.new("Attachment")
  144. attachment13.Parent = Seat
  145. alignposition3 = Instance.new("HingeConstraint")
  146. alignposition3.Parent = Seat
  147. alignposition3.ActuatorType = "Motor"
  148. alignposition3.MotorMaxAcceleration = 100000000000
  149. alignposition3.MotorMaxTorque = 100000000000
  150. alignposition3.Name = "Hinge1"
  151. alignposition3.Attachment0 = attachment03
  152. alignposition3.Attachment1 = attachment13
  153. attachment13.WorldCFrame = attachment13.Parent.CFrame * CFrame.new(-3.739,-0.5,6.45)* CFrame.Angles(0,math.rad(180),0)
  154. local attachment023 = Instance.new("Attachment")
  155. attachment023.Parent = wheel4
  156. local attachment123 = Instance.new("Attachment")
  157. attachment123.Parent = Seat
  158. alignposition23 = Instance.new("HingeConstraint")
  159. alignposition23.Parent = Seat
  160. alignposition23.ActuatorType = "Motor"
  161. alignposition23.MotorMaxAcceleration = 100000000000
  162. alignposition23.MotorMaxTorque = 100000000000
  163. alignposition23.Name = "Hinge2"
  164. alignposition23.Attachment0 = attachment023
  165. alignposition23.Attachment1 = attachment123
  166. attachment123.WorldCFrame = attachment123.Parent.CFrame * CFrame.new(3.739,-0.5,6.45)
  167. local motor1 = alignposition3
  168. local motor2 = alignposition23
  169. local steerServo = alignposition
  170. local steerServo2 = alignposition2
  171. local maxSpeed = 57.5
  172. local angleSteer = 27.5
  173. local function carMove(property)
  174. if property == "Throttle" then
  175. alignposition23.AngularVelocity = Seat.Throttle * maxSpeed
  176. alignposition3.AngularVelocity = Seat.Throttle * -maxSpeed
  177. elseif property == "Steer" then
  178. alignposition.TargetAngle = angleSteer * Seat.Steer
  179. alignposition2.TargetAngle = angleSteer * Seat.Steer
  180. end
  181. end
  182. Seat.Changed:Connect(carMove)
  183. local density = 1
  184. local friction = 1
  185. local elasticity = 0
  186. local frictionWeight = 100000000000
  187. local elasticityWeight = 0
  188. local physProperties = PhysicalProperties.new(density, friction, elasticity, frictionWeight, elasticityWeight)
  189. Seat.CustomPhysicalProperties = physProperties
  190. wheel.CustomPhysicalProperties = physProperties
  191. wheel2.CustomPhysicalProperties = physProperties
  192. wheel3.CustomPhysicalProperties = physProperties
  193. wheel4.CustomPhysicalProperties = physProperties
  194. wait(0.25)
  195. Seat.Anchored = false
  196. Mesh2 = Instance.new("SpecialMesh")
  197. Mesh2.Parent = wheel
  198. Mesh2.MeshId = "http://www.roblox.com/asset/?id=439151274"
  199. Mesh2.TextureId = "http://www.roblox.com/asset/?id=1110514085"
  200. Mesh2.Scale = Vector3.new(0.045,0.045,0.045)
  201. Mesh3 = Instance.new("SpecialMesh")
  202. Mesh3.Parent = wheel2
  203. Mesh3.MeshId = "http://www.roblox.com/asset/?id=439151274"
  204. Mesh3.TextureId = "http://www.roblox.com/asset/?id=1110514085"
  205. Mesh3.Scale = Vector3.new(0.045,0.045,0.045)
  206. Mesh4 = Instance.new("SpecialMesh")
  207. Mesh4.Parent = wheel3
  208. Mesh4.MeshId = "http://www.roblox.com/asset/?id=439151274"
  209. Mesh4.TextureId = "http://www.roblox.com/asset/?id=1110514085"
  210. Mesh4.Scale = Vector3.new(0.045,0.045,0.045)
  211. Mesh5 = Instance.new("SpecialMesh")
  212. Mesh5.Parent = wheel4
  213. Mesh5.MeshId = "http://www.roblox.com/asset/?id=439151274"
  214. Mesh5.TextureId = "http://www.roblox.com/asset/?id=1110514085"
  215. Mesh5.Scale = Vector3.new(0.045, 0.045, 0.045)
RAW Paste Data