Advertisement
TheUnknownDiscord

zero g plane

Dec 29th, 2021 (edited)
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.31 KB | None | 0 0
  1. part = Instance.new("Part",script)
  2. part.Size = Vector3.new(4,1,7.5)
  3. part.Material = "SmoothPlastic"
  4. seat = Instance.new("VehicleSeat",script)
  5. seat.Size = Vector3.new(2,0.5,2)
  6. seat.Material = "SmoothPlastic"
  7. seat.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.new(0,0,-10)
  8. weld = Instance.new("Weld",seat)
  9. weld.Part0 = part
  10. weld.Part1 = seat
  11. weld.C0 = CFrame.new(0,0.5,0)
  12. bv = Instance.new("BodyVelocity",seat)
  13. bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
  14. bv.Velocity = Vector3.new()
  15. bg = Instance.new("BodyGyro",seat)
  16. bg.MaxTorque = Vector3.new(math.huge,math.huge,math.huge)
  17. bg.P = 10000
  18. steering = false
  19. going = false
  20. local function carMove(property)
  21. if property == "Throttle" then
  22. if seat.Throttle ~= 0 then
  23. going = true
  24. else
  25. going = false
  26. end
  27. elseif property == "Steer" then
  28. if seat.Steer ~= 0 then
  29. steering = true
  30. else
  31. steering = false
  32. end
  33. end
  34. end
  35. who = nil
  36. prox = Instance.new("ProximityPrompt",seat)
  37. prox.Style = Enum.ProximityPromptStyle.Custom
  38. prox2 = Instance.new("ProximityPrompt",seat)
  39. prox2.Style = Enum.ProximityPromptStyle.Custom
  40. prox3 = Instance.new("ProximityPrompt",seat)
  41. prox3.Style = Enum.ProximityPromptStyle.Custom
  42. prox4 = Instance.new("ProximityPrompt",seat)
  43. prox4.Style = Enum.ProximityPromptStyle.Custom
  44. prox5 = Instance.new("ProximityPrompt",seat)
  45. prox5.Style = Enum.ProximityPromptStyle.Custom
  46. prox6 = Instance.new("ProximityPrompt",seat)
  47. prox6.Style = Enum.ProximityPromptStyle.Custom
  48. prox7 = Instance.new("ProximityPrompt",seat)
  49. prox7.Style = Enum.ProximityPromptStyle.Custom
  50. seat.Changed:Connect(carMove)
  51. seat:GetPropertyChangedSignal("Occupant"):Connect(function()
  52. if seat.Occupant then
  53. local Model = seat.Occupant:FindFirstAncestorOfClass("Model")
  54. if Model then
  55. local PC = game:GetService("Players"):GetPlayerFromCharacter(Model)
  56. if PC then
  57. who = PC
  58. else
  59. who = nil
  60. end
  61. else
  62. who = nil
  63. end
  64. else
  65. who = nil
  66. end
  67. end)
  68. up = false
  69. prox.Enabled = true
  70. prox.Triggered:Connect(function(player)
  71. if player == who then
  72. up = true
  73. end
  74. end)
  75. prox.TriggerEnded:Connect(function(player)
  76. if player == who then
  77. up = false
  78. end
  79. end)
  80. down = false
  81. prox2.Enabled = true
  82. prox2.KeyboardKeyCode = Enum.KeyCode.Q
  83. prox2.Triggered:Connect(function(player)
  84. if player == who then
  85. down = true
  86. end
  87. end)
  88. prox2.TriggerEnded:Connect(function(player)
  89. if player == who then
  90. down = false
  91. end
  92. end)
  93. left = false
  94. prox3.Enabled = true
  95. prox3.KeyboardKeyCode = Enum.KeyCode.Z
  96. prox3.Triggered:Connect(function(player)
  97. if player == who then
  98. left = true
  99. end
  100. end)
  101. prox3.TriggerEnded:Connect(function(player)
  102. if player == who then
  103. left = false
  104. end
  105. end)
  106. right = false
  107. prox4.Enabled = true
  108. prox4.KeyboardKeyCode = Enum.KeyCode.C
  109. prox4.Triggered:Connect(function(player)
  110. if player == who then
  111. right = true
  112. end
  113. end)
  114. prox4.TriggerEnded:Connect(function(player)
  115. if player == who then
  116. right = false
  117. end
  118. end)
  119. rup = false
  120. prox5.Enabled = true
  121. prox5.KeyboardKeyCode = Enum.KeyCode.R
  122. prox5.Triggered:Connect(function(player)
  123. if player == who then
  124. rup = true
  125. end
  126. end)
  127. prox5.TriggerEnded:Connect(function(player)
  128. if player == who then
  129. rup = false
  130. end
  131. end)
  132. rdown = false
  133. prox6.Enabled = true
  134. prox6.KeyboardKeyCode = Enum.KeyCode.F
  135. prox6.Triggered:Connect(function(player)
  136. if player == who then
  137. rdown = true
  138. end
  139. end)
  140. prox6.TriggerEnded:Connect(function(player)
  141. if player == who then
  142. rdown = false
  143. end
  144. end)
  145. level = false
  146. prox7.Enabled = true
  147. prox7.KeyboardKeyCode = Enum.KeyCode.X
  148. prox7.Triggered:Connect(function(player)
  149. coroutine.wrap(function()
  150. if player == who then
  151. level = true
  152. wait()
  153. level = false
  154. end
  155. end)()
  156. end)
  157. while true do
  158. task.wait()
  159. if steering then
  160. bg.CFrame = bg.CFrame * CFrame.Angles(0,math.rad(seat.Steer * -2),0)
  161. end
  162. if going then
  163. seat.CFrame = seat.CFrame * CFrame.new(0,0,seat.Throttle * -0.5)
  164. end
  165. if up then
  166. seat.CFrame = seat.CFrame * CFrame.new(0,0.5,0)
  167. elseif down then
  168. seat.CFrame = seat.CFrame * CFrame.new(0,-0.5,0)
  169. end
  170. if left then
  171. bg.CFrame = bg.CFrame * CFrame.Angles(0,0,math.rad(2))
  172. elseif right then
  173. bg.CFrame = bg.CFrame * CFrame.Angles(0,0,math.rad(-2))
  174. end
  175. if rup then
  176. bg.CFrame = bg.CFrame * CFrame.Angles(math.rad(2),0,0)
  177. elseif rdown then
  178. bg.CFrame = bg.CFrame * CFrame.Angles(math.rad(-2),0,0)
  179. end
  180. if level then
  181. local x,y,z = bg.CFrame:ToOrientation()
  182. bg.CFrame = CFrame.Angles(0,y,0)
  183. end
  184. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement