TheUnknownDiscord

pong

Nov 17th, 2021 (edited)
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. seat = Instance.new("VehicleSeat", script)
  2. seat.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.new(-5,0,10)
  3. stand = Instance.new("Part", script)
  4. stand.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.new(0,-2.5,10)
  5. stand.Size = Vector3.new(15,5,10)
  6. stand.Anchored = true
  7. stand.Material = "SmoothPlastic"
  8. seat.Material = "SmoothPlastic"
  9. seat2 = Instance.new("VehicleSeat", script)
  10. seat2.Material = "SmoothPlastic"
  11. seat.Color = Color3.fromRGB(0,0,0)
  12. seat2.Color = Color3.fromRGB(0,0,0)
  13. seat2.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.new(5,0,10)
  14. paddle = Instance.new("Part", script)
  15. paddle.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.new(-15,10,5)
  16. paddle.Color = Color3.fromRGB(255,255,255)
  17. paddle.Size = Vector3.new(1,7.5,0.125)
  18. paddle.CanCollide = false
  19. paddle3 = Instance.new("Part", script)
  20. paddle3.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.new(0,16,5)
  21. oldcf = owner.Character.HumanoidRootPart.CFrame * CFrame.new(0,16,5)
  22. paddle3.Color = Color3.fromRGB(255,255,255)
  23. paddle3.Size = Vector3.new(1,1,0.125)
  24. bounce = Instance.new("Sound",paddle3)
  25. bounce.SoundId = "rbxassetid://877986348"
  26. bounce.Volume = 7.5
  27. paddle2 = Instance.new("Part", script)
  28. paddle2.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.new(15,10,5)
  29. paddle2.Color = Color3.fromRGB(255,255,255)
  30. paddle2.Size = Vector3.new(1,7.5,0.125)
  31. paddle2.CanCollide = false
  32. wall = Instance.new("Part", script)
  33. wall.CanTouch = false
  34. wall.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.new(0,16,4.875)
  35. wall.Size = Vector3.new(40,20,0.125)
  36. wall.Anchored = true
  37. wall.Color = Color3.fromRGB(0,0,0)
  38. wall4 = Instance.new("Part", script)
  39. wall4.CanTouch = false
  40. wall4.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.new(0,16,5.25)
  41. wall4.Size = Vector3.new(40,20,0.05)
  42. wall4.Anchored = true
  43. wall4.Transparency = 0.75
  44. wall7 = Instance.new("Part", script)
  45. wall7.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.new(-15,30,4.875)
  46. wall7.Size = Vector3.new(5,5,0.05)
  47. wall7.Anchored = true
  48. wall8 = Instance.new("Part", script)
  49. wall8.CanTouch = false
  50. wall8.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.new(15,30,4.875)
  51. wall8.Size = Vector3.new(5,5,0.125)
  52. wall8.Anchored = true
  53. local screengui3 = Instance.new("SurfaceGui", wall7)
  54. screengui3.Name = "Hud3"
  55. screengui3.Face = Enum.NormalId.Back
  56. tl1 = Instance.new("TextBox", screengui3)
  57. tl1.Size = UDim2.new(1, 0, 1, 0)
  58. tl1.BackgroundTransparency = 1
  59. tl1.Text = "Score 0"
  60. screengui3.AlwaysOnTop = true
  61. local screengui4 = Instance.new("SurfaceGui", wall8)
  62. screengui4.Name = "Hud3"
  63. screengui4.Face = Enum.NormalId.Back
  64. tl2 = Instance.new("TextBox", screengui4)
  65. tl2.Size = UDim2.new(1, 0, 1, 0)
  66. tl2.BackgroundTransparency = 1
  67. tl2.Text = "Score 0"
  68. screengui3.AlwaysOnTop = true
  69. tl2.TextSize = 200
  70. tl1.TextSize = 200
  71. tl1.TextColor3 = Color3.fromRGB(255,255,255)
  72. tl2.TextColor3 = Color3.fromRGB(255,255,255)
  73. wall2 = Instance.new("Part", script)
  74. wall2.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.new(0,6,5)
  75. wall2.Size = Vector3.new(40,0.525,0.5)
  76. wall2.Anchored = true
  77. wall2.Color = Color3.fromRGB(0,0,0)
  78. wall2.Name = "Limits"
  79. wall5 = Instance.new("Part", script)
  80. wall5.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.new(20,16,5)
  81. wall5.Size = Vector3.new(0.525,20,0.5)
  82. wall5.Anchored = true
  83. wall5.Color = Color3.fromRGB(0,0,0)
  84. wall5.Name = "Limits3"
  85. wall6 = Instance.new("Part", script)
  86. wall6.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.new(-20,16,5)
  87. wall6.Size = Vector3.new(0.525,20,0.5)
  88. wall6.Anchored = true
  89. wall6.Color = Color3.fromRGB(0,0,0)
  90. wall6.Name = "Limits4"
  91. wall3 = Instance.new("Part", script)
  92. wall3.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.new(0,26,5)
  93. wall3.Size = Vector3.new(40,0.525,0.5)
  94. wall3.Anchored = true
  95. wall3.Color = Color3.fromRGB(0,0,0)
  96. wall3.Name = "Limits2"
  97. seat.Anchored = true
  98. seat2.Anchored = true
  99. speed = 25
  100. bp = Instance.new("BodyPosition",paddle)
  101. bp.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
  102. bp.P = 1000000
  103. bp.Position = paddle.Position
  104. bg = Instance.new("BodyGyro",paddle)
  105. bg.MaxTorque = Vector3.new(math.huge,math.huge,math.huge)
  106. bp3 = Instance.new("BodyPosition",paddle2)
  107. bp3.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
  108. bp3.P = 1000000
  109. bp3.Position = paddle2.Position
  110. bg3 = Instance.new("BodyGyro",paddle2)
  111. bg3.MaxTorque = Vector3.new(math.huge,math.huge,math.huge)
  112. bp2 = Instance.new("BodyVelocity",paddle3)
  113. bp2.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
  114. bp2.Velocity = Vector3.new(0,0,0)
  115. bg2 = Instance.new("BodyGyro",paddle3)
  116. bg2.MaxTorque = Vector3.new(math.huge,math.huge,math.huge)
  117. bg2.P = 100000000
  118. bg3.P = 100000000
  119. bg.P = 100000000
  120. for i,v in pairs(script:GetDescendants()) do
  121. if v:IsA("Part") then
  122. v.Locked = true
  123. end
  124. end
  125. bg2.CFrame = paddle3.CFrame
  126. bg3.CFrame = paddle2.CFrame
  127. bg.CFrame = paddle.CFrame
  128. on = false
  129. on2 = false
  130. start = false
  131. local function carMove(property)
  132. pcall(function()
  133. if seat.Occupant ~= nil then
  134. paddle:SetNetworkOwner(game:GetService("Players"):GetPlayerFromCharacter(seat.Occupant.Parent))
  135. end
  136. end)
  137. if property == "Throttle" then
  138. if seat.Throttle ~= 0 then
  139. on = true
  140. elseif seat.Throttle == 0 then
  141. on = false
  142. end
  143. elseif property == "Steer" then
  144. if seat.Steer == -1 then
  145. if not start then
  146. bp2.Velocity = paddle3.CFrame.rightVector * 10
  147. start = true
  148. elseif start then
  149. bp2.Velocity = Vector3.new(0,0,0)
  150. paddle3.CFrame = oldcf
  151. start = false
  152. end
  153. elseif seat.Steer == 1 then
  154. paddle3.CFrame = oldcf
  155. end
  156. end
  157. end
  158. local function carMove2(property)
  159. pcall(function()
  160. if seat2.Occupant ~= nil then
  161. paddle2:SetNetworkOwner(game:GetService("Players"):GetPlayerFromCharacter(seat.Occupant.Parent))
  162. end
  163. end)
  164. if property == "Throttle" then
  165. if seat2.Throttle ~= 0 then
  166. on2 = true
  167. elseif seat2.Throttle == 0 then
  168. on2 = false
  169. end
  170. end
  171. end
  172. seat.Changed:Connect(carMove)
  173. seat2.Changed:Connect(carMove2)
  174. count = 0
  175. count2 = 0
  176. wait(0.1)
  177. local density = 10
  178. local friction = 0
  179. local elasticity = 0
  180. local frictionWeight = 100000000000
  181. local elasticityWeight = 0
  182. local physProperties = PhysicalProperties.new(density, friction, elasticity, frictionWeight, elasticityWeight)
  183. paddle.CustomPhysicalProperties = physProperties
  184. paddle2.CustomPhysicalProperties = physProperties
  185. paddle3.CustomPhysicalProperties = physProperties
  186. seat:Sit(owner.Character.Humanoid)
  187. currentz = paddle.Position.z
  188. currentz2 = paddle2.Position.z
  189. paddle3.Touched:Connect(function(hit)
  190. coroutine.wrap(function()
  191. if hit.Name ~= "Limits3" then
  192. if hit.Name ~= "Limits4" then
  193. if hit.Name ~= "Limits" then
  194. if hit.Name ~= "Limits2" then
  195. bounce.PlaybackSpeed = math.random(0.85,1.25)
  196. bounce:Play()
  197. bp2.Velocity = CFrame.new(paddle3.Position,hit.Position).lookVector * -10
  198. elseif hit.Name == "Limits2" then
  199. bounce.PlaybackSpeed = math.random(0.85,1.25)
  200. bounce:Play()
  201. bp2.Velocity = bp2.Velocity + Vector3.new(0,-10,0)
  202. end
  203. elseif hit.Name == "Limits" then
  204. bounce.PlaybackSpeed = math.random(0.85,1.25)
  205. bounce:Play()
  206. bp2.Velocity = bp2.Velocity + Vector3.new(0,10,0)
  207. end
  208. elseif hit.Name == "Limits4" then
  209. count = count + 1
  210. paddle3.CFrame = oldcf
  211. tl2.Text = "Score "..count
  212. end
  213. elseif hit.Name == "Limits3" then
  214. count2 = count2 + 1
  215. paddle3.CFrame = oldcf
  216. tl1.Text = "Score "..count2
  217. end
  218. end)()
  219. end)
  220. while true do
  221. task.wait()
  222. if on then
  223. bp.Position = Vector3.new(paddle.Position.x,math.clamp(paddle.Position.y,14,24),currentz) + Vector3.new(0,seat.Throttle * 1.5,0)
  224. end
  225. if on2 then
  226. bp3.Position = Vector3.new(paddle2.Position.x,math.clamp(paddle2.Position.y,14,24),currentz2) + Vector3.new(0,seat2.Throttle * 1.5,0)
  227. end
  228. end
Add Comment
Please, Sign In to add comment