Advertisement
firebudgy

Untitled

Feb 19th, 2018
363
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 41.86 KB | None | 0 0
  1.  
  2. --Converted with ttyyuu12345's model to script plugin v4
  3. function sandbox(var,func)
  4. local env = getfenv(func)
  5. local newenv = setmetatable({},{
  6. __index = function(self,k)
  7. if k=="script" then
  8. return var
  9. else
  10. return env[k]
  11. end
  12. end,
  13. })
  14. setfenv(func,newenv)
  15. return func
  16. end
  17. cors = {}
  18. mas = Instance.new("Model",game:GetService("Lighting"))
  19. Model0 = Instance.new("Model")
  20. Part1 = Instance.new("Part")
  21. Part2 = Instance.new("Part")
  22. Part3 = Instance.new("Part")
  23. Seat4 = Instance.new("Seat")
  24. Seat5 = Instance.new("Seat")
  25. Part6 = Instance.new("Part")
  26. Part7 = Instance.new("Part")
  27. CylinderMesh8 = Instance.new("CylinderMesh")
  28. Part9 = Instance.new("Part")
  29. Part10 = Instance.new("Part")
  30. Part11 = Instance.new("Part")
  31. CylinderMesh12 = Instance.new("CylinderMesh")
  32. Part13 = Instance.new("Part")
  33. Part14 = Instance.new("Part")
  34. Part15 = Instance.new("Part")
  35. Part16 = Instance.new("Part")
  36. Part17 = Instance.new("Part")
  37. SurfaceGui18 = Instance.new("SurfaceGui")
  38. Frame19 = Instance.new("Frame")
  39. Script20 = Instance.new("Script")
  40. Script21 = Instance.new("Script")
  41. Script22 = Instance.new("Script")
  42. Frame23 = Instance.new("Frame")
  43. Frame24 = Instance.new("Frame")
  44. Script25 = Instance.new("Script")
  45. TextLabel26 = Instance.new("TextLabel")
  46. TextLabel27 = Instance.new("TextLabel")
  47. TextLabel28 = Instance.new("TextLabel")
  48. TextLabel29 = Instance.new("TextLabel")
  49. TextLabel30 = Instance.new("TextLabel")
  50. IntValue31 = Instance.new("IntValue")
  51. IntValue32 = Instance.new("IntValue")
  52. TextButton33 = Instance.new("TextButton")
  53. TextButton34 = Instance.new("TextButton")
  54. TextButton35 = Instance.new("TextButton")
  55. TextButton36 = Instance.new("TextButton")
  56. TextLabel37 = Instance.new("TextLabel")
  57. TextLabel38 = Instance.new("TextLabel")
  58. TextLabel39 = Instance.new("TextLabel")
  59. Frame40 = Instance.new("Frame")
  60. Script41 = Instance.new("Script")
  61. TextButton42 = Instance.new("TextButton")
  62. TextButton43 = Instance.new("TextButton")
  63. ImageLabel44 = Instance.new("ImageLabel")
  64. Frame45 = Instance.new("Frame")
  65. ImageLabel46 = Instance.new("ImageLabel")
  66. TextButton47 = Instance.new("TextButton")
  67. Script48 = Instance.new("Script")
  68. Frame49 = Instance.new("Frame")
  69. ImageLabel50 = Instance.new("ImageLabel")
  70. Script51 = Instance.new("Script")
  71. Frame52 = Instance.new("Frame")
  72. ImageLabel53 = Instance.new("ImageLabel")
  73. Script54 = Instance.new("Script")
  74. SpotLight55 = Instance.new("SpotLight")
  75. Tool56 = Instance.new("Tool")
  76. LocalScript57 = Instance.new("LocalScript")
  77. ScreenGui58 = Instance.new("ScreenGui")
  78. Part59 = Instance.new("Part")
  79. Part60 = Instance.new("Part")
  80. Model0.Name = "Pong Machine"
  81. Model0.Parent = mas
  82. Part1.Parent = Model0
  83. Part1.Material = Enum.Material.Fabric
  84. Part1.BrickColor = BrickColor.new("Really blue")
  85. Part1.Rotation = Vector3.new(-15.5, -14.4799995, -3.97000003)
  86. Part1.Anchored = true
  87. Part1.FormFactor = Enum.FormFactor.Custom
  88. Part1.Size = Vector3.new(2.99999976, 3.60000038, 0.400000006)
  89. Part1.CFrame = CFrame.new(49.5499992, 1.79043996, 54.1632233, 0.965925813, 0.0669872984, -0.25, 0, 0.965925813, 0.258819044, 0.258819044, -0.25, 0.933012664)
  90. Part1.FrontSurface = Enum.SurfaceType.Weld
  91. Part1.Color = Color3.new(0, 0, 1)
  92. Part1.Position = Vector3.new(49.5499992, 1.79043996, 54.1632233)
  93. Part1.Orientation = Vector3.new(-15, -15, 0)
  94. Part1.Color = Color3.new(0, 0, 1)
  95. Part2.Parent = Model0
  96. Part2.Material = Enum.Material.Fabric
  97. Part2.BrickColor = BrickColor.new("Bright red")
  98. Part2.Rotation = Vector3.new(-15.5, 14.4799995, 3.97000003)
  99. Part2.Anchored = true
  100. Part2.FormFactor = Enum.FormFactor.Custom
  101. Part2.Size = Vector3.new(2.99999976, 3.60000038, 0.400000006)
  102. Part2.CFrame = CFrame.new(43.4500008, 1.79043996, 54.1632233, 0.965925813, -0.0669873431, 0.249999985, 4.69434305e-08, 0.965925813, 0.258819044, -0.258819044, -0.25, 0.933012664)
  103. Part2.FrontSurface = Enum.SurfaceType.Weld
  104. Part2.Color = Color3.new(0.768628, 0.156863, 0.109804)
  105. Part2.Position = Vector3.new(43.4500008, 1.79043996, 54.1632233)
  106. Part2.Orientation = Vector3.new(-15, 15, 0)
  107. Part2.Color = Color3.new(0.768628, 0.156863, 0.109804)
  108. Part3.Parent = Model0
  109. Part3.Material = Enum.Material.DiamondPlate
  110. Part3.BrickColor = BrickColor.new("Dark stone grey")
  111. Part3.Anchored = true
  112. Part3.FormFactor = Enum.FormFactor.Custom
  113. Part3.Size = Vector3.new(9, 0.200000003, 9)
  114. Part3.CFrame = CFrame.new(46.5, 0.241914004, 58.5, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  115. Part3.TopSurface = Enum.SurfaceType.Smooth
  116. Part3.Color = Color3.new(0.388235, 0.372549, 0.384314)
  117. Part3.Position = Vector3.new(46.5, 0.241914004, 58.5)
  118. Part3.Color = Color3.new(0.388235, 0.372549, 0.384314)
  119. Seat4.Parent = Model0
  120. Seat4.Material = Enum.Material.Fabric
  121. Seat4.BrickColor = BrickColor.new("Really blue")
  122. Seat4.Rotation = Vector3.new(164.5, 14.4799995, -176.029999)
  123. Seat4.Size = Vector3.new(3, 1.20000005, 2)
  124. Seat4.CFrame = CFrame.new(49.1696167, 0.941911995, 55.58284, -0.965925813, 0.0669872984, 0.25, 0, 0.965925813, -0.258819044, -0.258819044, -0.25, -0.933012664)
  125. Seat4.BackSurface = Enum.SurfaceType.Weld
  126. Seat4.TopSurface = Enum.SurfaceType.Smooth
  127. Seat4.Color = Color3.new(0, 0, 1)
  128. Seat4.Position = Vector3.new(49.1696167, 0.941911995, 55.58284)
  129. Seat4.Orientation = Vector3.new(15, 165, 0)
  130. Seat4.Color = Color3.new(0, 0, 1)
  131. Seat5.Parent = Model0
  132. Seat5.Material = Enum.Material.Fabric
  133. Seat5.BrickColor = BrickColor.new("Bright red")
  134. Seat5.Rotation = Vector3.new(164.5, -14.4799995, 176.029999)
  135. Seat5.Size = Vector3.new(3, 1.20000005, 2)
  136. Seat5.CFrame = CFrame.new(43.8303833, 0.941911995, 55.58284, -0.965925813, -0.0669873431, -0.249999985, -4.69434305e-08, 0.965925813, -0.258819044, 0.258819044, -0.25, -0.933012664)
  137. Seat5.BackSurface = Enum.SurfaceType.Weld
  138. Seat5.TopSurface = Enum.SurfaceType.Smooth
  139. Seat5.Color = Color3.new(0.768628, 0.156863, 0.109804)
  140. Seat5.Position = Vector3.new(43.8303833, 0.941911995, 55.58284)
  141. Seat5.Orientation = Vector3.new(15, -165, 0)
  142. Seat5.Color = Color3.new(0.768628, 0.156863, 0.109804)
  143. Part6.Name = "Speaker"
  144. Part6.Parent = Model0
  145. Part6.Material = Enum.Material.DiamondPlate
  146. Part6.BrickColor = BrickColor.new("Light stone grey")
  147. Part6.Anchored = true
  148. Part6.FormFactor = Enum.FormFactor.Custom
  149. Part6.Size = Vector3.new(1, 3.20000005, 2)
  150. Part6.CFrame = CFrame.new(46.5, 1.94191301, 62, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  151. Part6.TopSurface = Enum.SurfaceType.Smooth
  152. Part6.Color = Color3.new(0.898039, 0.894118, 0.87451)
  153. Part6.Position = Vector3.new(46.5, 1.94191301, 62)
  154. Part6.Color = Color3.new(0.898039, 0.894118, 0.87451)
  155. Part7.Parent = Model0
  156. Part7.Material = Enum.Material.DiamondPlate
  157. Part7.BrickColor = BrickColor.new("Mid gray")
  158. Part7.Anchored = true
  159. Part7.FormFactor = Enum.FormFactor.Custom
  160. Part7.Size = Vector3.new(0.400000036, 2, 2)
  161. Part7.CFrame = CFrame.new(43.2000008, 2.54190707, 62, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  162. Part7.Color = Color3.new(0.803922, 0.803922, 0.803922)
  163. Part7.Position = Vector3.new(43.2000008, 2.54190707, 62)
  164. Part7.Color = Color3.new(0.803922, 0.803922, 0.803922)
  165. CylinderMesh8.Parent = Part7
  166. Part9.Parent = Model0
  167. Part9.Material = Enum.Material.DiamondPlate
  168. Part9.BrickColor = BrickColor.new("Bright red")
  169. Part9.Anchored = true
  170. Part9.FormFactor = Enum.FormFactor.Custom
  171. Part9.Size = Vector3.new(2, 3.19999981, 2)
  172. Part9.CFrame = CFrame.new(45, 1.94191301, 62, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  173. Part9.TopSurface = Enum.SurfaceType.Smooth
  174. Part9.Color = Color3.new(0.768628, 0.156863, 0.109804)
  175. Part9.Position = Vector3.new(45, 1.94191301, 62)
  176. Part9.Color = Color3.new(0.768628, 0.156863, 0.109804)
  177. Part10.Parent = Model0
  178. Part10.Material = Enum.Material.DiamondPlate
  179. Part10.BrickColor = BrickColor.new("Really blue")
  180. Part10.Anchored = true
  181. Part10.FormFactor = Enum.FormFactor.Custom
  182. Part10.Size = Vector3.new(2, 3.20000005, 2)
  183. Part10.CFrame = CFrame.new(48, 1.94191301, 62, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  184. Part10.TopSurface = Enum.SurfaceType.Smooth
  185. Part10.Color = Color3.new(0, 0, 1)
  186. Part10.Position = Vector3.new(48, 1.94191301, 62)
  187. Part10.Color = Color3.new(0, 0, 1)
  188. Part11.Parent = Model0
  189. Part11.Material = Enum.Material.DiamondPlate
  190. Part11.BrickColor = BrickColor.new("Mid gray")
  191. Part11.Anchored = true
  192. Part11.FormFactor = Enum.FormFactor.Custom
  193. Part11.Size = Vector3.new(0.400000036, 2, 2)
  194. Part11.CFrame = CFrame.new(49.7999992, 2.54190707, 62, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  195. Part11.Color = Color3.new(0.803922, 0.803922, 0.803922)
  196. Part11.Position = Vector3.new(49.7999992, 2.54190707, 62)
  197. Part11.Color = Color3.new(0.803922, 0.803922, 0.803922)
  198. CylinderMesh12.Parent = Part11
  199. Part13.Parent = Model0
  200. Part13.Material = Enum.Material.DiamondPlate
  201. Part13.Anchored = true
  202. Part13.FormFactor = Enum.FormFactor.Custom
  203. Part13.Size = Vector3.new(2, 1.20000005, 2)
  204. Part13.CFrame = CFrame.new(43, 0.941911995, 62, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  205. Part13.TopSurface = Enum.SurfaceType.Smooth
  206. Part13.Position = Vector3.new(43, 0.941911995, 62)
  207. Part14.Parent = Model0
  208. Part14.Material = Enum.Material.DiamondPlate
  209. Part14.Anchored = true
  210. Part14.FormFactor = Enum.FormFactor.Custom
  211. Part14.Size = Vector3.new(2, 1.20000005, 2)
  212. Part14.CFrame = CFrame.new(50, 0.941911995, 62, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  213. Part14.TopSurface = Enum.SurfaceType.Smooth
  214. Part14.Position = Vector3.new(50, 0.941911995, 62)
  215. Part15.Parent = Model0
  216. Part15.Material = Enum.Material.DiamondPlate
  217. Part15.BrickColor = BrickColor.new("Dark stone grey")
  218. Part15.Anchored = true
  219. Part15.FormFactor = Enum.FormFactor.Custom
  220. Part15.Size = Vector3.new(7.39999962, 0.200000003, 2)
  221. Part15.CFrame = CFrame.new(46.5, 3.64190602, 62.1999969, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  222. Part15.TopSurface = Enum.SurfaceType.Smooth
  223. Part15.Color = Color3.new(0.388235, 0.372549, 0.384314)
  224. Part15.Position = Vector3.new(46.5, 3.64190602, 62.1999969)
  225. Part15.Color = Color3.new(0.388235, 0.372549, 0.384314)
  226. Part16.Parent = Model0
  227. Part16.Material = Enum.Material.DiamondPlate
  228. Part16.BrickColor = BrickColor.new("Light stone grey")
  229. Part16.Rotation = Vector3.new(-15, 0, 90)
  230. Part16.Anchored = true
  231. Part16.FormFactor = Enum.FormFactor.Custom
  232. Part16.Size = Vector3.new(6.20000076, 0.200000003, 0.999999821)
  233. Part16.CFrame = CFrame.new(42.9000015, 6.63849306, 61.2741165, 0, -0.99999994, 0, 0.965925753, 0, 0.258819014, -0.258819014, 0, 0.965925694)
  234. Part16.TopSurface = Enum.SurfaceType.Smooth
  235. Part16.Color = Color3.new(0.898039, 0.894118, 0.87451)
  236. Part16.Position = Vector3.new(42.9000015, 6.63849306, 61.2741165)
  237. Part16.Orientation = Vector3.new(-15, 0, 90)
  238. Part16.Color = Color3.new(0.898039, 0.894118, 0.87451)
  239. Part17.Name = "screen"
  240. Part17.Parent = Model0
  241. Part17.BrickColor = BrickColor.new("Really black")
  242. Part17.Rotation = Vector3.new(-15, 0, 0)
  243. Part17.Anchored = true
  244. Part17.FormFactor = Enum.FormFactor.Custom
  245. Part17.Size = Vector3.new(7, 6, 0.200000003)
  246. Part17.CFrame = CFrame.new(46.5, 6.54190302, 61.3000031, 1, 0, 0, 0, 0.965925813, 0.258819044, 0, -0.258819044, 0.965925813)
  247. Part17.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
  248. Part17.Position = Vector3.new(46.5, 6.54190302, 61.3000031)
  249. Part17.Orientation = Vector3.new(-15, 0, 0)
  250. Part17.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
  251. SurfaceGui18.Name = "Game"
  252. SurfaceGui18.Parent = Part17
  253. Frame19.Name = "Game"
  254. Frame19.Parent = SurfaceGui18
  255. Frame19.Transparency = 1
  256. Frame19.Size = UDim2.new(1, 0, 1, 0)
  257. Frame19.Visible = false
  258. Frame19.BackgroundColor3 = Color3.new(1, 1, 1)
  259. Frame19.BackgroundTransparency = 1
  260. Script20.Name = "Controls"
  261. Script20.Parent = Frame19
  262. table.insert(cors,sandbox(Script20,function()
  263. B = script.Parent.GAME.BluPdl
  264. R = script.Parent.GAME.RedPdl
  265.  
  266. script.Parent.UpRed.MouseButton1Click:connect(function()
  267. print("UpRed")
  268. if R.Position.Y.Offset > 0 then
  269. R.Position = UDim2.new(0, 560, 0, (R.Position.Y.Offset - 20))
  270. end
  271. end)
  272.  
  273. script.Parent.DownRed.MouseButton1Click:connect(function()
  274. print("DownRed")
  275. if R.Position.Y.Offset < 400 then
  276. R.Position = UDim2.new(0, 560, 0, (R.Position.Y.Offset + 20))
  277. end
  278. end)
  279.  
  280. script.Parent.UpBlu.MouseButton1Click:connect(function()
  281. print("UpBlu")
  282. if B.Position.Y.Offset > 0 then
  283. B.Position = UDim2.new(0, 0, 0, (B.Position.Y.Offset - 20))
  284. end
  285. end)
  286.  
  287. script.Parent.DownBlu.MouseButton1Click:connect(function()
  288. print("DownBlu")
  289. if B.Position.Y.Offset < 400 then
  290. B.Position = UDim2.new(0, 0, 0, (B.Position.Y.Offset + 20))
  291. end
  292. end)
  293.  
  294. end))
  295. Script21.Name = "Initialize"
  296. Script21.Parent = Frame19
  297. table.insert(cors,sandbox(Script21,function()
  298. script.Parent.GAME.BluPdl.Position = UDim2.new(0,0,0,200)
  299. script.Parent.GAME.RedPdl.Position = UDim2.new(0,560,0,200)
  300. script.Parent.GAME.Ball.Visible = false
  301. script.Parent.GAME.Ball.Position = UDim2.new (0, 290, 0, 250)
  302. script.Parent.GAME.Ready.Text = "3"
  303. script.Parent.GAME.Ready.Visible = true
  304. script.Parent.GAME.bScore.Visible = false
  305. script.Parent.GAME.rScore.Visible = false
  306. wait(1)
  307. script.Parent.GAME.Ready.Text = "2"
  308. script.Parent.GAME.Ball.Position = UDim2.new (0, 290, 0, 250)
  309. wait(1)
  310. script.Parent.GAME.Ready.Text = "1"
  311. script.Parent.GAME.Ball.Position = UDim2.new (0, 290, 0, 250)
  312. wait(1)
  313. script.Parent.GAME.Ready.Text = "GO"
  314. script.Parent.GAME.Ball.Position = UDim2.new (0, 290, 0, 250)
  315. wait(1)
  316. script.Parent.GAME.Ready.Visible = false
  317. script.Parent.GAME.Ready.Text = "3"
  318. script.Parent.GAME.Ball.Visible = true
  319. script.Parent.GAME.Ball.Position = UDim2.new (0, 90, 0, 250)
  320. script.Parent.GAME.BluScore.Value = 0
  321. script.Parent.GAME.RedScore.Value = 0
  322. script.Parent.Parent.Game.GAME.Ball.Movement.Disabled = true
  323. script.Parent.Parent.Game.GAME.Ball.Movement.Disabled = false
  324. end))
  325. Script22.Name = "ScoreDisplay"
  326. Script22.Parent = Frame19
  327. table.insert(cors,sandbox(Script22,function()
  328. R = script.Parent.GAME.RedScore
  329. B = script.Parent.GAME.BluScore
  330. Rd = script.Parent.ScoreRed
  331. Bd = script.Parent.ScoreBlu
  332.  
  333. R.Changed:connect(function()
  334. Rd.Text = "Score: " .. R.Value
  335. if R.Value == 300 then
  336. script.Parent.Parent.RedWins.Active = true
  337. script.Parent.Parent.RedWins.Visible = true
  338. script.Parent.Parent.RedWins.Script.Disabled = true
  339. script.Parent.Parent.RedWins.Script.Disabled = false
  340. script.Parent.Visible = false
  341. script.Parent.Active = false
  342.  
  343. end
  344. end)
  345.  
  346. B.Changed:connect(function()
  347. Bd.Text = "Score: " .. B.Value
  348. if B.Value == 300 then
  349. script.Parent.Parent.BlueWins.Active = true
  350. script.Parent.Parent.BlueWins.Visible = true
  351. script.Parent.Parent.BlueWins.Script.Disabled = true
  352. script.Parent.Parent.BlueWins.Script.Disabled = false
  353. script.Parent.Visible = false
  354. script.Parent.Active = false
  355.  
  356. end
  357. end)
  358. end))
  359. Frame23.Name = "GAME"
  360. Frame23.Parent = Frame19
  361. Frame23.Size = UDim2.new(0, 580, 0, 500)
  362. Frame23.Position = UDim2.new(0, 110, 0, 85)
  363. Frame23.BackgroundColor3 = Color3.new(0, 0, 0)
  364. Frame23.BorderColor3 = Color3.new(0.333333, 1, 0)
  365. Frame23.BorderSizePixel = 10
  366. Frame24.Name = "Ball"
  367. Frame24.Parent = Frame23
  368. Frame24.Size = UDim2.new(0, 20, 0, 20)
  369. Frame24.Position = UDim2.new(0, 490, 0, 250)
  370. Frame24.Visible = false
  371. Frame24.BackgroundColor3 = Color3.new(1, 1, 1)
  372. Frame24.BorderColor3 = Color3.new(1, 1, 0)
  373. Frame24.BorderSizePixel = 3
  374. Script25.Name = "Movement"
  375. Script25.Parent = Frame24
  376. Script25.Disabled = true
  377. table.insert(cors,sandbox(Script25,function()
  378. B = script.Parent
  379. Pr = script.Parent.Parent.RedPdl
  380. Pb = script.Parent.Parent.BluPdl
  381. Vy = 5
  382. Vx = 8
  383.  
  384. script.Changed:connect(function()
  385. while true do
  386. wait(0.03)
  387. math.randomseed(tick())
  388. if B.Position.Y.Offset <= 10 then
  389. Vy = 5 + ((math.random()+0.3)*10)
  390. end
  391. if B.Position.Y.Offset >= 480 then
  392. Vy = -5 - ((math.random()+0.3)*10)
  393. end
  394. --Oh ho ho ho, here goes the paddling system
  395. --RED PADDLES
  396. if B.Position.X.Offset >= 540 then
  397. if B.Position.Y.Offset > (Pr.Position.Y.Offset - 20) and B.Position.Y.Offset < (Pr.Position.Y.Offset + 30) then
  398. Vx = -8
  399. Vy = -5 - ((math.random()+0.3)*10)
  400. end
  401. if B.Position.Y.Offset >= (Pr.Position.Y.Offset + 30) and B.Position.Y.Offset < (Pr.Position.Y.Offset + 100) then
  402. Vx = -8
  403. Vy = 5 + ((math.random()+0.3)*10)
  404. end
  405. end
  406.  
  407. --BLUE PADDLES
  408. if B.Position.X.Offset <= 20 then
  409. if B.Position.Y.Offset > (Pb.Position.Y.Offset - 20) and B.Position.Y.Offset < (Pb.Position.Y.Offset + 30) then
  410. Vx = 8
  411. Vy = -5 - ((math.random()+0.3)*10)
  412. end
  413. if B.Position.Y.Offset >= (Pb.Position.Y.Offset + 30) and B.Position.Y.Offset < (Pb.Position.Y.Offset + 100) then
  414. Vx = 8
  415. Vy = 5 + ((math.random()+0.3)*10)
  416. end
  417. end
  418.  
  419. --SCORING
  420. --RED SIDE ( BLUE SCORES )
  421. if B.Position.X.Offset >= 560 then
  422. B.Visible = false
  423. Vx = -8
  424. Vy = -5 - ((math.random()+0.3)*10)
  425. B.Position = UDim2.new (0, 490, 0, 250)
  426. script.Parent.Parent.bScore.Visible = true
  427. wait(1)
  428. script.Parent.Parent.bScore.Visible = false
  429. wait(0.2)
  430. script.Parent.Parent.bScore.Visible = true
  431. wait(1)
  432. script.Parent.Parent.bScore.Visible = false
  433. wait(1)
  434. script.Parent.Parent.BluScore.Value = (script.Parent.Parent.BluScore.Value + 100)
  435. if script.Parent.Parent.BluScore.Value == 300 then
  436. break
  437. end
  438. script.Parent.Parent.Ready.Visible = true
  439. wait(1)
  440. script.Parent.Parent.Ready.Text = "2"
  441. wait(1)
  442. script.Parent.Parent.Ready.Text = "1"
  443. wait(1)
  444. script.Parent.Parent.Ready.Text = "GO"
  445. wait(1)
  446. script.Parent.Parent.Ready.Visible = false
  447. script.Parent.Parent.Ready.Text = "3"
  448. B.Visible = true
  449. end
  450. --BLU SIDE ( RED SCORES )
  451. if B.Position.X.Offset <= 0 then
  452. B.Visible = false
  453. Vx = 8
  454. Vy = 5 + ((math.random()+0.3)*10)
  455. B.Position = UDim2.new (0, 90, 0, 250)
  456. script.Parent.Parent.rScore.Visible = true
  457. wait(1)
  458. script.Parent.Parent.rScore.Visible = false
  459. wait(0.2)
  460. script.Parent.Parent.rScore.Visible = true
  461. wait(1)
  462. script.Parent.Parent.rScore.Visible = false
  463. wait(1)
  464. script.Parent.Parent.RedScore.Value = (script.Parent.Parent.RedScore.Value + 100)
  465. if script.Parent.Parent.RedScore.Value == 300 then
  466. break
  467. end
  468. script.Parent.Parent.Ready.Visible = true
  469. wait(1)
  470. script.Parent.Parent.Ready.Text = "2"
  471. wait(1)
  472. script.Parent.Parent.Ready.Text = "1"
  473. wait(1)
  474. script.Parent.Parent.Ready.Text = "GO"
  475. wait(1)
  476. script.Parent.Parent.Ready.Visible = false
  477. script.Parent.Parent.Ready.Text = "3"
  478. B.Visible = true
  479. end
  480.  
  481. B.Position = UDim2.new(0, (B.Position.X.Offset + Vx), 0, (B.Position.Y.Offset + Vy))
  482. if script.Parent.Parent.BluScore.Value == 300 then
  483. break
  484. end
  485. if script.Parent.Parent.RedScore.Value == 300 then
  486. break
  487. end
  488. end
  489. end)
  490. end))
  491. TextLabel26.Name = "RedPdl"
  492. TextLabel26.Parent = Frame23
  493. TextLabel26.Size = UDim2.new(0, 20, 0, 100)
  494. TextLabel26.Text = ""
  495. TextLabel26.Position = UDim2.new(0, 560, 0, 260)
  496. TextLabel26.BackgroundColor3 = Color3.new(1, 0, 0)
  497. TextLabel26.BorderColor3 = Color3.new(1, 0, 0)
  498. TextLabel26.Font = Enum.Font.SourceSans
  499. TextLabel26.FontSize = Enum.FontSize.Size14
  500. TextLabel27.Name = "BluPdl"
  501. TextLabel27.Parent = Frame23
  502. TextLabel27.Size = UDim2.new(0, 20, 0, 100)
  503. TextLabel27.Text = ""
  504. TextLabel27.Position = UDim2.new(0, 0, 0, 340)
  505. TextLabel27.BackgroundColor3 = Color3.new(0, 0.333333, 1)
  506. TextLabel27.BorderColor3 = Color3.new(0, 0.333333, 1)
  507. TextLabel27.Font = Enum.Font.SourceSans
  508. TextLabel27.FontSize = Enum.FontSize.Size14
  509. TextLabel28.Name = "bScore"
  510. TextLabel28.Parent = Frame23
  511. TextLabel28.Transparency = 0.5
  512. TextLabel28.Size = UDim2.new(0, 400, 0, 100)
  513. TextLabel28.Text = "Blue Scores!"
  514. TextLabel28.Position = UDim2.new(0.5, -200, 0, 0)
  515. TextLabel28.Visible = false
  516. TextLabel28.BackgroundColor3 = Color3.new(0, 0.666667, 1)
  517. TextLabel28.BackgroundTransparency = 0.5
  518. TextLabel28.Font = Enum.Font.SourceSans
  519. TextLabel28.FontSize = Enum.FontSize.Size48
  520. TextLabel28.TextColor3 = Color3.new(1, 1, 1)
  521. TextLabel28.TextStrokeTransparency = 0
  522. TextLabel29.Name = "rScore"
  523. TextLabel29.Parent = Frame23
  524. TextLabel29.Transparency = 0.5
  525. TextLabel29.Size = UDim2.new(0, 400, 0, 100)
  526. TextLabel29.Text = "Red Scores!"
  527. TextLabel29.Position = UDim2.new(0.5, -200, 0, 400)
  528. TextLabel29.Visible = false
  529. TextLabel29.BackgroundColor3 = Color3.new(1, 0, 0)
  530. TextLabel29.BackgroundTransparency = 0.5
  531. TextLabel29.Font = Enum.Font.SourceSans
  532. TextLabel29.FontSize = Enum.FontSize.Size48
  533. TextLabel29.TextColor3 = Color3.new(1, 1, 1)
  534. TextLabel29.TextStrokeTransparency = 0
  535. TextLabel30.Name = "Ready"
  536. TextLabel30.Parent = Frame23
  537. TextLabel30.Transparency = 1
  538. TextLabel30.Size = UDim2.new(0, 100, 0, 100)
  539. TextLabel30.Text = "3"
  540. TextLabel30.Position = UDim2.new(0.5, -50, 0.5, -50)
  541. TextLabel30.Visible = false
  542. TextLabel30.BackgroundColor3 = Color3.new(1, 1, 1)
  543. TextLabel30.BackgroundTransparency = 1
  544. TextLabel30.Font = Enum.Font.SourceSansBold
  545. TextLabel30.FontSize = Enum.FontSize.Size48
  546. TextLabel30.TextColor3 = Color3.new(1, 1, 1)
  547. TextLabel30.TextWrapped = true
  548. IntValue31.Name = "BluScore"
  549. IntValue31.Parent = Frame23
  550. IntValue31.Value = 300
  551. IntValue32.Name = "RedScore"
  552. IntValue32.Parent = Frame23
  553. TextButton33.Name = "DownBlu"
  554. TextButton33.Parent = Frame19
  555. TextButton33.Size = UDim2.new(0, 80, 0, 100)
  556. TextButton33.Text = "Dn"
  557. TextButton33.Position = UDim2.new(0, 10, 0, 480)
  558. TextButton33.BackgroundColor3 = Color3.new(0, 0.666667, 1)
  559. TextButton33.Font = Enum.Font.ArialBold
  560. TextButton33.FontSize = Enum.FontSize.Size48
  561. TextButton34.Name = "DownRed"
  562. TextButton34.Parent = Frame19
  563. TextButton34.Size = UDim2.new(0, 80, 0, 100)
  564. TextButton34.Text = "Dn"
  565. TextButton34.Position = UDim2.new(0, 710, 0, 480)
  566. TextButton34.BackgroundColor3 = Color3.new(1, 0, 0)
  567. TextButton34.Font = Enum.Font.ArialBold
  568. TextButton34.FontSize = Enum.FontSize.Size48
  569. TextButton35.Name = "UpBlu"
  570. TextButton35.Parent = Frame19
  571. TextButton35.Size = UDim2.new(0, 80, 0, 100)
  572. TextButton35.Text = "Up"
  573. TextButton35.Position = UDim2.new(0, 10, 0, 80)
  574. TextButton35.BackgroundColor3 = Color3.new(0, 0.666667, 1)
  575. TextButton35.Font = Enum.Font.ArialBold
  576. TextButton35.FontSize = Enum.FontSize.Size48
  577. TextButton36.Name = "UpRed"
  578. TextButton36.Parent = Frame19
  579. TextButton36.Size = UDim2.new(0, 80, 0, 100)
  580. TextButton36.Text = "Up"
  581. TextButton36.Position = UDim2.new(0, 710, 0, 80)
  582. TextButton36.BackgroundColor3 = Color3.new(1, 0, 0)
  583. TextButton36.Font = Enum.Font.ArialBold
  584. TextButton36.FontSize = Enum.FontSize.Size48
  585. TextLabel37.Name = "BG"
  586. TextLabel37.Parent = Frame19
  587. TextLabel37.Transparency = 1
  588. TextLabel37.Size = UDim2.new(0, 600, 0, 500)
  589. TextLabel37.Text = ""
  590. TextLabel37.Position = UDim2.new(0, 100, 0, 80)
  591. TextLabel37.BackgroundColor3 = Color3.new(0, 0, 0)
  592. TextLabel37.BackgroundTransparency = 1
  593. TextLabel37.BorderColor3 = Color3.new(0, 1, 0)
  594. TextLabel37.BorderSizePixel = 5
  595. TextLabel37.Font = Enum.Font.SourceSans
  596. TextLabel37.FontSize = Enum.FontSize.Size14
  597. TextLabel38.Name = "ScoreBlu"
  598. TextLabel38.Parent = Frame19
  599. TextLabel38.Transparency = 1
  600. TextLabel38.Size = UDim2.new(0, 100, 0, 100)
  601. TextLabel38.Text = "Score: 300"
  602. TextLabel38.Position = UDim2.new(0, 100, 0, 0)
  603. TextLabel38.BackgroundColor3 = Color3.new(1, 1, 1)
  604. TextLabel38.BackgroundTransparency = 1
  605. TextLabel38.Font = Enum.Font.SourceSans
  606. TextLabel38.FontSize = Enum.FontSize.Size48
  607. TextLabel38.TextColor3 = Color3.new(0, 0.333333, 1)
  608. TextLabel39.Name = "ScoreRed"
  609. TextLabel39.Parent = Frame19
  610. TextLabel39.Transparency = 1
  611. TextLabel39.Size = UDim2.new(0, 100, 0, 100)
  612. TextLabel39.Text = "Score: 0"
  613. TextLabel39.Position = UDim2.new(0, 580, 0, 0)
  614. TextLabel39.BackgroundColor3 = Color3.new(1, 1, 1)
  615. TextLabel39.BackgroundTransparency = 1
  616. TextLabel39.Font = Enum.Font.SourceSans
  617. TextLabel39.FontSize = Enum.FontSize.Size48
  618. TextLabel39.TextColor3 = Color3.new(1, 0, 0)
  619. Frame40.Name = "StartScreen"
  620. Frame40.Parent = SurfaceGui18
  621. Frame40.Transparency = 1
  622. Frame40.Size = UDim2.new(1, 0, 1, 0)
  623. Frame40.Active = true
  624. Frame40.BackgroundColor3 = Color3.new(1, 1, 1)
  625. Frame40.BackgroundTransparency = 1
  626. Script41.Parent = Frame40
  627. table.insert(cors,sandbox(Script41,function()
  628. script.Parent.Start.MouseButton1Click:connect(function()
  629. print("Game Start")
  630. script.Parent.Parent.Game.Active = true
  631. script.Parent.Parent.Game.Visible = true
  632. script.Parent.Parent.Game.Initialize.Disabled = true
  633. script.Parent.Parent.Game.Initialize.Disabled = false
  634. script.Parent.Parent.Game.GAME.Ball.Movement.Disabled = false
  635. script.Parent.Visible = false
  636. script.Parent.Active = false
  637. end)
  638.  
  639. script.Parent.HowToPlay.MouseButton1Click:connect(function()
  640. print("Game Start")
  641. script.Parent.Parent.HowToPlay.Active = true
  642. script.Parent.Parent.HowToPlay.Visible = true
  643. script.Parent.Visible = false
  644. script.Parent.Active = false
  645. end)
  646.  
  647. end))
  648. TextButton42.Name = "HowToPlay"
  649. TextButton42.Parent = Frame40
  650. TextButton42.Size = UDim2.new(0, 300, 0, 100)
  651. TextButton42.Text = "HOW TO PLAY"
  652. TextButton42.Position = UDim2.new(0.700000048, -150, 0.699999988, 0)
  653. TextButton42.BackgroundColor3 = Color3.new(0, 0, 0)
  654. TextButton42.BorderColor3 = Color3.new(0.333333, 1, 1)
  655. TextButton42.BorderSizePixel = 10
  656. TextButton42.Font = Enum.Font.SourceSansBold
  657. TextButton42.FontSize = Enum.FontSize.Size48
  658. TextButton42.TextColor3 = Color3.new(1, 1, 1)
  659. TextButton43.Name = "Start"
  660. TextButton43.Parent = Frame40
  661. TextButton43.Size = UDim2.new(0, 300, 0, 100)
  662. TextButton43.Text = "START"
  663. TextButton43.Position = UDim2.new(0.300000012, -150, 0.699999988, 0)
  664. TextButton43.BackgroundColor3 = Color3.new(0, 0, 0)
  665. TextButton43.BorderColor3 = Color3.new(0, 0.333333, 1)
  666. TextButton43.BorderSizePixel = 10
  667. TextButton43.Font = Enum.Font.SourceSansBold
  668. TextButton43.FontSize = Enum.FontSize.Size48
  669. TextButton43.TextColor3 = Color3.new(1, 1, 1)
  670. TextButton43.TextWrapped = true
  671. ImageLabel44.Parent = Frame40
  672. ImageLabel44.Transparency = 1
  673. ImageLabel44.Size = UDim2.new(1, -100, 1, -200)
  674. ImageLabel44.Position = UDim2.new(0, 50, 0, 0)
  675. ImageLabel44.BackgroundColor3 = Color3.new(1, 1, 1)
  676. ImageLabel44.BackgroundTransparency = 1
  677. ImageLabel44.Image = "http://www.roblox.com/asset/?id=139116259"
  678. Frame45.Name = "HowToPlay"
  679. Frame45.Parent = SurfaceGui18
  680. Frame45.Transparency = 1
  681. Frame45.Size = UDim2.new(1, 0, 1, 0)
  682. Frame45.Visible = false
  683. Frame45.BackgroundColor3 = Color3.new(1, 1, 1)
  684. Frame45.BackgroundTransparency = 1
  685. ImageLabel46.Parent = Frame45
  686. ImageLabel46.Transparency = 1
  687. ImageLabel46.Size = UDim2.new(1, -100, 1, -200)
  688. ImageLabel46.Position = UDim2.new(0, 50, 0, 0)
  689. ImageLabel46.BackgroundColor3 = Color3.new(1, 1, 1)
  690. ImageLabel46.BackgroundTransparency = 1
  691. ImageLabel46.Image = "http://www.roblox.com/asset/?id=139120696"
  692. TextButton47.Name = "Done"
  693. TextButton47.Parent = Frame45
  694. TextButton47.Size = UDim2.new(0, 300, 0, 100)
  695. TextButton47.Text = "OK"
  696. TextButton47.Position = UDim2.new(0.5, -150, 0.699999988, 0)
  697. TextButton47.BackgroundColor3 = Color3.new(0, 0, 0)
  698. TextButton47.BorderColor3 = Color3.new(0, 0.333333, 1)
  699. TextButton47.BorderSizePixel = 10
  700. TextButton47.Font = Enum.Font.SourceSansBold
  701. TextButton47.FontSize = Enum.FontSize.Size48
  702. TextButton47.TextColor3 = Color3.new(1, 1, 1)
  703. TextButton47.TextWrapped = true
  704. Script48.Parent = Frame45
  705. table.insert(cors,sandbox(Script48,function()
  706. script.Parent.Done.MouseButton1Click:connect(function()
  707. script.Parent.Parent.StartScreen.Active = true
  708. script.Parent.Parent.StartScreen.Visible = true
  709. script.Parent.Visible = false
  710. script.Parent.Active = false
  711. end)
  712.  
  713. end))
  714. Frame49.Name = "RedWins"
  715. Frame49.Parent = SurfaceGui18
  716. Frame49.Transparency = 1
  717. Frame49.Size = UDim2.new(1, 0, 1, 0)
  718. Frame49.Visible = false
  719. Frame49.BackgroundColor3 = Color3.new(1, 1, 1)
  720. Frame49.BackgroundTransparency = 1
  721. ImageLabel50.Parent = Frame49
  722. ImageLabel50.Transparency = 1
  723. ImageLabel50.Size = UDim2.new(1, -100, 1, -100)
  724. ImageLabel50.Position = UDim2.new(0, 50, 0, 50)
  725. ImageLabel50.BackgroundColor3 = Color3.new(1, 1, 1)
  726. ImageLabel50.BackgroundTransparency = 1
  727. ImageLabel50.Image = "http://www.roblox.com/asset/?id=139120645"
  728. Script51.Parent = Frame49
  729. table.insert(cors,sandbox(Script51,function()
  730. wait(5)
  731. script.Parent.Parent.Game.GAME.Ball.Movement.Disabled = true
  732. script.Parent.Visible = false
  733. script.Parent.Active = false
  734. script.Parent.Parent.StartScreen.Active = true
  735. script.Parent.Parent.StartScreen.Visible = true
  736.  
  737.  
  738. end))
  739. Frame52.Name = "BlueWins"
  740. Frame52.Parent = SurfaceGui18
  741. Frame52.Transparency = 1
  742. Frame52.Size = UDim2.new(1, 0, 1, 0)
  743. Frame52.Visible = false
  744. Frame52.BackgroundColor3 = Color3.new(1, 1, 1)
  745. Frame52.BackgroundTransparency = 1
  746. ImageLabel53.Parent = Frame52
  747. ImageLabel53.Transparency = 1
  748. ImageLabel53.Size = UDim2.new(1, -100, 1, -100)
  749. ImageLabel53.Position = UDim2.new(0, 50, 0, 50)
  750. ImageLabel53.BackgroundColor3 = Color3.new(1, 1, 1)
  751. ImageLabel53.BackgroundTransparency = 1
  752. ImageLabel53.Image = "http://www.roblox.com/asset/?id=139120623"
  753. Script54.Parent = Frame52
  754. table.insert(cors,sandbox(Script54,function()
  755. wait(5)
  756. script.Parent.Parent.Game.GAME.Ball.Movement.Disabled = true
  757. script.Parent.Visible = false
  758. script.Parent.Active = false
  759. script.Parent.Parent.StartScreen.Active = true
  760. script.Parent.Parent.StartScreen.Visible = true
  761.  
  762.  
  763. end))
  764. SpotLight55.Parent = Part17
  765. Tool56.Name = "2DGame"
  766. Tool56.Parent = Model0
  767. Tool56.TextureId = "http://www.roblox.com/asset/?id=33681144"
  768. Tool56.GripForward = Vector3.new(-0, 0.707106769, -0.707106769)
  769. Tool56.GripPos = Vector3.new(0.300000012, -0.5, 0)
  770. Tool56.GripUp = Vector3.new(0, 0.707106769, 0.707106769)
  771. LocalScript57.Parent = Tool56
  772. table.insert(cors,sandbox(LocalScript57,function()
  773. local Tool = script.Parent
  774. local gui = nil
  775. local mapParts = {}
  776. local player = nil
  777.  
  778. local keyDownCon = nil
  779. local keyUpCon = nil
  780. local clickCon = nil
  781.  
  782. local platforming = false
  783.  
  784. local time = 0
  785.  
  786. local gaming = true
  787.  
  788. local head = nil
  789.  
  790. local left = false
  791. local right = false
  792. local jump = false
  793.  
  794. local prize = nil
  795. local prizeRegenTimer = 0
  796.  
  797. local walkCounter = 0
  798. local playerWalkForward = {"32171523","32171543","32171566","32171582","32171594"}
  799. local playerWalkBackward = {"32168430","32168450","32168470","32168483","32168492"}
  800.  
  801. local playerVelocity = Vector2.new(0,0)
  802.  
  803. function onEquipped(mouse)
  804.  
  805. Tool.Handle.Song:Stop()
  806. Tool.Handle.Jump:Stop()
  807. Tool.Handle.Prize:Stop()
  808. Tool.Handle.Fail:Stop()
  809. enabled = false
  810.  
  811. gui = Tool.GameGui:clone()
  812. player = gui.Cabinet.Screen.Player
  813. mapParts = gui.Cabinet.Screen.Map:GetChildren()
  814.  
  815. keyDownCon = mouse.KeyDown:connect(onKeyDown)
  816. keyUpCon = mouse.KeyUp:connect(onKeyUp)
  817. clickCon = gui.Cabinet.SoundOnOff.MouseButton1Click:connect(soundChanger)
  818.  
  819. if Tool.Handle.Song.Volume == 0 then
  820. gui.Cabinet.SoundOnOff.Image = "http://www.roblox.com/asset/?id=32203595"
  821. else
  822. gui.Cabinet.SoundOnOff.Image = "http://www.roblox.com/asset/?id=32203454"
  823. end
  824.  
  825. head = Tool.Parent:FindFirstChild("Head")
  826.  
  827. end
  828.  
  829. Tool.Equipped:connect(onEquipped)
  830.  
  831. function onUnequipped()
  832.  
  833. gaming = false
  834. head.Anchored = false
  835.  
  836. Tool.Handle.Song:Stop()
  837. Tool.Handle.Jump:Stop()
  838. Tool.Handle.Prize:Stop()
  839. Tool.Handle.Fail:Stop()
  840.  
  841. game.Workspace.CurrentCamera.CameraType = 5
  842. gui:remove()
  843.  
  844. keyDownCon:disconnect()
  845. keyUpCon:disconnect()
  846. clickCon:disconnect()
  847. clickCon = nil
  848. keyDownCon = nil
  849. keyUpCon = nil
  850.  
  851. end
  852.  
  853. Tool.Unequipped:connect(onUnequipped)
  854.  
  855. local enabled = false
  856.  
  857. function onActivated()
  858.  
  859. if enabled then return end
  860.  
  861. enabled = true
  862.  
  863. game.Workspace.CurrentCamera.CameraType = 1
  864. head.Anchored = true
  865. prize = nil
  866. prizeRegenTimer = 0
  867. time = 0
  868. gui.Parent = game.Players:GetPlayerFromCharacter(Tool.Parent).PlayerGui
  869.  
  870. Tool.Handle.Song:Play()
  871.  
  872. gameLoop()
  873.  
  874. Tool.Handle.Song:Stop()
  875. gui:remove()
  876. gui = Tool.GameGui:clone()
  877. clickCon = gui.Cabinet.SoundOnOff.MouseButton1Click:connect(soundChanger)
  878. if Tool.Handle.Song.Volume == 0 then
  879. gui.Cabinet.SoundOnOff.Image = "http://www.roblox.com/asset/?id=32203595"
  880. else
  881. gui.Cabinet.SoundOnOff.Image = "http://www.roblox.com/asset/?id=32203454"
  882. end
  883. player = gui.Cabinet.Screen.Player
  884. mapParts = gui.Cabinet.Screen.Map:GetChildren()
  885. game.Workspace.CurrentCamera.CameraType = 5
  886. head.Anchored = false
  887.  
  888. enabled = false
  889.  
  890. end
  891.  
  892. Tool.Activated:connect(onActivated)
  893.  
  894. function soundChanger()
  895.  
  896. if gui.Cabinet.SoundOnOff.Image == "http://www.roblox.com/asset/?id=32203454" then
  897. gui.Cabinet.SoundOnOff.Image = "http://www.roblox.com/asset/?id=32203595"
  898. Tool.Handle.Song.Volume = 0
  899. Tool.Handle.Jump.Volume = 0
  900. Tool.Handle.Prize.Volume = 0
  901. Tool.Handle.Fail.Volume = 0
  902. else
  903. gui.Cabinet.SoundOnOff.Image = "http://www.roblox.com/asset/?id=32203454"
  904. Tool.Handle.Song.Volume = 0.5
  905. Tool.Handle.Jump.Volume = 0.5
  906. Tool.Handle.Prize.Volume = 0.5
  907. Tool.Handle.Fail.Volume = 0.5
  908. end
  909.  
  910. end
  911.  
  912. function onKeyDown(key)
  913.  
  914. key:lower()
  915. if key == "a" then
  916. left = true
  917. right = false
  918. elseif key == "d" then
  919. left = false
  920. right = true
  921. elseif key == "w" then
  922. jump = true
  923. end
  924.  
  925. end
  926.  
  927.  
  928. function onKeyUp(key)
  929.  
  930. key:lower()
  931. if key == "a" then
  932. left = false
  933. elseif key == "d" then
  934. right = false
  935. elseif key == "w" then
  936. jump = false
  937. end
  938.  
  939. end
  940.  
  941.  
  942. function Physics()
  943.  
  944. if playerVelocity.y < 8 then
  945. playerVelocity = Vector2.new(playerVelocity.x,playerVelocity.y + 1)
  946. end
  947. if playerVelocity.y > 1 then
  948. platforming = false
  949. end
  950. local enemies = gui.Cabinet.Screen.Enemies:GetChildren()
  951. for i = 1, #enemies do
  952. enemies[i].Position = UDim2.new(0,enemies[i].Position.X.Offset,0,enemies[i].Position.Y.Offset + 5)
  953. end
  954.  
  955. end
  956.  
  957.  
  958. function Touching(a,b)
  959. local ap = Vector2.new(a.Position.X.Offset, a.Position.Y.Offset)
  960. local as = Vector2.new(a.Size.X.Offset, a.Size.Y.Offset)
  961. local bp = Vector2.new(b.Position.X.Offset, b.Position.Y.Offset)
  962. local bs = Vector2.new(b.Size.X.Offset, b.Size.Y.Offset)
  963. local c = (ap.x + as.x > bp.x) and (bp.x + bs.x > ap.x) and (ap.y + as.y > bp.y) and (bp.y + bs.y > ap.y)
  964. if c then
  965. return true
  966. else
  967. return false
  968. end
  969. end
  970.  
  971.  
  972.  
  973. function Collision()
  974.  
  975. -- check player against map
  976. for i = 1, #mapParts do
  977.  
  978. if Touching(mapParts[i],player) then
  979.  
  980. if player.Position.X.Offset < mapParts[i].Position.X.Offset and not platforming then
  981. player.Position = UDim2.new(0, mapParts[i].Position.X.Offset - player.Size.X.Offset,0,player.Position.Y.Offset)
  982. playerVelocity = Vector2.new(0,playerVelocity.y)
  983. elseif player.Position.X.Offset + player.Size.X.Offset > mapParts[i].Position.X.Offset + mapParts[i].Size.X.Offset and not platforming then
  984. player.Position = UDim2.new(0, mapParts[i].Position.X.Offset + mapParts[i].Size.X.Offset,0,player.Position.Y.Offset)
  985. playerVelocity = Vector2.new(0,playerVelocity.y)
  986. else
  987. if player.Position.Y.Offset > mapParts[i].Position.Y.Offset then
  988. playerVelocity = Vector2.new(playerVelocity.x,10)
  989. platforming = false
  990. elseif player.Position.Y.Offset + player.Size.Y.Offset > mapParts[i].Position.Y.Offset then
  991. platforming = true
  992. playerVelocity = Vector2.new(playerVelocity.x,0)
  993. end
  994. end
  995.  
  996. end
  997.  
  998. end
  999.  
  1000. -- check enemies against map, player
  1001. local enemies = gui.Cabinet.Screen.Enemies:GetChildren()
  1002. for i = 1, #enemies do
  1003. for j = 1, #mapParts do
  1004. if Touching(mapParts[j],enemies[i]) then
  1005. enemies[i].Position = UDim2.new(0,enemies[i].Position.X.Offset,0,mapParts[j].Position.Y.Offset - enemies[i].Size.Y.Offset)
  1006. end
  1007. end
  1008. if enemies[i].Position.X.Offset > 384 or enemies[i].Position.X.Offset < 0 then
  1009. if enemies[i].Position.Y.Offset > 230 then
  1010. enemies[i]:remove()
  1011. else
  1012. enemies[i].Left.Value = not enemies[i].Left.Value
  1013. end
  1014. end
  1015. if Touching(enemies[i],player) then
  1016. gaming = false
  1017. end
  1018. end
  1019.  
  1020. -- check game bounds
  1021. if player.Position.X.Offset < 0 then
  1022. playerVelocity = Vector2.new(0,playerVelocity.y)
  1023. player.Position = UDim2.new(0,0,0,player.Position.Y.Offset)
  1024. elseif player.Position.X.Offset > 384 then
  1025. playerVelocity = Vector2.new(0,playerVelocity.y)
  1026. player.Position = UDim2.new(0,384,0,player.Position.Y.Offset)
  1027. end
  1028.  
  1029. if player.Position.Y.Offset < 0 then
  1030. playerVelocity = Vector2.new(playerVelocity.x,0)
  1031. player.Position = UDim2.new(0,player.Position.X.Offset,0,0)
  1032. end
  1033.  
  1034. -- check player against prize
  1035. if prize ~= nil and Touching(player,prize) then
  1036. time = time + 100
  1037. Tool.Handle.Prize:Play()
  1038. prize:remove()
  1039. prize = nil
  1040. prizeRegenTimer = math.random(180,360)
  1041. end
  1042.  
  1043. end
  1044.  
  1045. function updatePlayerPos()
  1046.  
  1047. if math.abs(playerVelocity.x) > 4 then
  1048. if playerVelocity.x < 0 then
  1049. playerVelocity = Vector2.new(-4,playerVelocity.y)
  1050. else
  1051. playerVelocity = Vector2.new(4,playerVelocity.y)
  1052. end
  1053. end
  1054. player.Position = UDim2.new(0,player.Position.X.Offset + playerVelocity.x,0,player.Position.Y.Offset + playerVelocity.y)
  1055. playerVelocity = Vector2.new(playerVelocity.x * 0.5,playerVelocity.y * 0.9)
  1056.  
  1057. end
  1058.  
  1059. function Controls()
  1060.  
  1061. if left then
  1062. playerVelocity = Vector2.new(playerVelocity.x - 3,playerVelocity.y)
  1063. elseif right then
  1064. playerVelocity = Vector2.new(playerVelocity.x + 3,playerVelocity.y)
  1065. end
  1066. if jump and platforming then
  1067. jump = false
  1068. platforming = false
  1069. Tool.Handle.Jump:Play()
  1070. playerVelocity = Vector2.new(playerVelocity.x,playerVelocity.y - 20)
  1071. end
  1072.  
  1073. end
  1074.  
  1075. function walkAnimation(forward)
  1076.  
  1077. walkCounter = walkCounter + 1
  1078. if walkCounter > 8 then
  1079. walkCounter = 1
  1080. end
  1081.  
  1082. local playIndex = walkCounter
  1083. if walkCounter == 4 then
  1084. playIndex = 2
  1085. elseif walkCounter == 5 then
  1086. playIndex = 1
  1087. elseif walkCounter == 6 then
  1088. playIndex = 4
  1089. elseif walkCounter == 7 then
  1090. playIndex = 5
  1091. elseif walkCounter == 8 then
  1092. playIndex = 4
  1093. end
  1094.  
  1095. if forward then
  1096. player.Image = "http://www.roblox.com/asset/?id=" .. playerWalkForward[playIndex]
  1097. else
  1098. player.Image = "http://www.roblox.com/asset/?id=" .. playerWalkBackward[playIndex]
  1099. end
  1100.  
  1101. end
  1102.  
  1103. local forward = true
  1104. function animation()
  1105.  
  1106. if playerVelocity.x > 1 then
  1107. forward = true
  1108. walkAnimation(forward)
  1109. elseif playerVelocity.x < -1 then
  1110. forward = false
  1111. walkAnimation(forward)
  1112. elseif forward then
  1113. player.Image = "http://www.roblox.com/asset/?id=" .. playerWalkForward[1]
  1114. walkCounter = 1
  1115. else
  1116. player.Image = "http://www.roblox.com/asset/?id=" .. playerWalkBackward[1]
  1117. walkCounter = 1
  1118. end
  1119.  
  1120. end
  1121.  
  1122. local left = true
  1123. function spawnEnemy()
  1124.  
  1125. local enemy = Instance.new("ImageLabel")
  1126. enemy.Image = "http://www.roblox.com/asset/?id=32183056"
  1127. enemy.Size = UDim2.new(0,16,0,16)
  1128. enemy.BackgroundTransparency = 1
  1129. enemy.BorderSizePixel = 0
  1130. enemy.ZIndex = 2
  1131. if left then
  1132. enemy.Position = UDim2.new(0,0,0,0)
  1133. else
  1134. enemy.Position = UDim2.new(0,380,0,0)
  1135. end
  1136. enemy.Name = "Enemy"
  1137. enemy.Parent = gui.Cabinet.Screen.Enemies
  1138.  
  1139. local leftDirection = Instance.new("BoolValue")
  1140. leftDirection.Name = "Left"
  1141. leftDirection.Value = not left
  1142. leftDirection.Parent = enemy
  1143.  
  1144. left = not left
  1145.  
  1146. end
  1147.  
  1148. local spawned = false
  1149. local maxEnemies = 0
  1150. function updateEnemies()
  1151.  
  1152. maxEnemies = 4 + (time/900)
  1153. local enemies = gui.Cabinet.Screen.Enemies:GetChildren()
  1154. if #enemies < maxEnemies and not spawned then
  1155. spawned = true
  1156. spawnEnemy()
  1157. local co = coroutine.create(function()
  1158. wait(math.random(1,3))
  1159. spawned = false
  1160. end)
  1161. coroutine.resume(co)
  1162. end
  1163. for i = 1, #enemies do
  1164.  
  1165. if enemies[i].Left.Value then
  1166. enemies[i].Position = UDim2.new(0,enemies[i].Position.X.Offset - 3,0,enemies[i].Position.Y.Offset)
  1167. else
  1168. enemies[i].Position = UDim2.new(0,enemies[i].Position.X.Offset + 3,0,enemies[i].Position.Y.Offset)
  1169. end
  1170.  
  1171. end
  1172.  
  1173. end
  1174.  
  1175. function updatePrize()
  1176. if prizeRegenTimer > 0 then
  1177. prizeRegenTimer = prizeRegenTimer - 1
  1178. return
  1179. end
  1180. if prize == nil then
  1181. prize = Instance.new("ImageLabel")
  1182. prize.Name = "Prize"
  1183. prize.Size = UDim2.new(0,24,0,24)
  1184. prize.Image = "http://www.roblox.com/asset/?id=32190862"
  1185. prize.BackgroundTransparency = 1
  1186. prize.BorderSizePixel = 0
  1187. prize.Parent = gui.Cabinet.Screen
  1188.  
  1189. local pos = math.random(1,4)
  1190. if pos == 1 then prize.Position = UDim2.new(0,24,0,120)
  1191. elseif pos == 2 then prize.Position = UDim2.new(0,350,0,120)
  1192. elseif pos == 3 then prize.Position = UDim2.new(0,350,0,230)
  1193. else prize.Position = UDim2.new(0,24,0,230) end
  1194. end
  1195. end
  1196.  
  1197. function gameOver()
  1198.  
  1199. Tool.Handle.Song:Stop()
  1200. Tool.Handle.Fail:Play()
  1201. wait(1)
  1202. if gui:FindFirstChild("Cabinet") then
  1203. gui.Cabinet:remove()
  1204. end
  1205. local scoreFrame = gui:FindFirstChild("ScoreFrame")
  1206. if scoreFrame then
  1207. scoreFrame.BackgroundTransparency = 0.2
  1208. end
  1209. while scoreFrame do
  1210. gui.ScoreFrame.Position = UDim2.new(0.5,gui.ScoreFrame.Position.X.Offset,0.5,gui.ScoreFrame.Position.Y.Offset - 3)
  1211. if gui.ScoreFrame.Position.Y.Offset <= 0 then wait(3) return end
  1212. wait()
  1213. end
  1214.  
  1215. end
  1216.  
  1217. function gameLoop()
  1218.  
  1219. animTimer = 0
  1220. gaming = true
  1221. while gaming do
  1222. Physics()
  1223. Collision()
  1224. Controls()
  1225. updatePlayerPos()
  1226. updateEnemies()
  1227. updatePrize()
  1228. time = time + 0.05
  1229. animTimer = animTimer + 1
  1230. if animTimer == 3 then
  1231. animation()
  1232. animTimer = 0
  1233. end
  1234. gui.ScoreFrame.Score.Text = tostring(math.floor(time))
  1235. wait(0.03)
  1236. end
  1237. if head.Anchored then
  1238. gameOver()
  1239. end
  1240.  
  1241. end
  1242.  
  1243. end))
  1244. ScreenGui58.Name = "GameGui"
  1245. ScreenGui58.Parent = Tool56
  1246. Part59.Parent = Model0
  1247. Part59.Material = Enum.Material.DiamondPlate
  1248. Part59.BrickColor = BrickColor.new("Light stone grey")
  1249. Part59.Rotation = Vector3.new(165, 0, -90)
  1250. Part59.Anchored = true
  1251. Part59.FormFactor = Enum.FormFactor.Custom
  1252. Part59.Size = Vector3.new(6.00000095, 0.200000003, 0.999999821)
  1253. Part59.CFrame = CFrame.new(50.0999985, 6.54193306, 61.2999954, -1.40092995e-08, 0.999992073, -6.17074321e-08, 0.965917349, -2.43911868e-09, -0.258816838, -0.258817732, -6.32307717e-08, -0.965919495)
  1254. Part59.TopSurface = Enum.SurfaceType.Smooth
  1255. Part59.Color = Color3.new(0.898039, 0.894118, 0.87451)
  1256. Part59.Position = Vector3.new(50.0999985, 6.54193306, 61.2999954)
  1257. Part59.Orientation = Vector3.new(15, -180, 90)
  1258. Part59.Color = Color3.new(0.898039, 0.894118, 0.87451)
  1259. Part60.Parent = Model0
  1260. Part60.Material = Enum.Material.DiamondPlate
  1261. Part60.BrickColor = BrickColor.new("Light stone grey")
  1262. Part60.Rotation = Vector3.new(-15, 0, 0)
  1263. Part60.Anchored = true
  1264. Part60.FormFactor = Enum.FormFactor.Custom
  1265. Part60.Size = Vector3.new(7.19999981, 0.200000003, 0.999999821)
  1266. Part60.CFrame = CFrame.new(46.5999985, 9.53627205, 60.4976654, 1, 0, 0, 0, 0.965925813, 0.258819044, 0, -0.258819044, 0.965925813)
  1267. Part60.TopSurface = Enum.SurfaceType.Smooth
  1268. Part60.Color = Color3.new(0.898039, 0.894118, 0.87451)
  1269. Part60.Position = Vector3.new(46.5999985, 9.53627205, 60.4976654)
  1270. Part60.Orientation = Vector3.new(-15, 0, 0)
  1271. Part60.Color = Color3.new(0.898039, 0.894118, 0.87451)
  1272. for i,v in pairs(mas:GetChildren()) do
  1273. v.Parent = workspace
  1274. pcall(function() v:MakeJoints() end)
  1275. end
  1276. mas:Destroy()
  1277. for i,v in pairs(cors) do
  1278. spawn(function()
  1279. pcall(v)
  1280. end)
  1281. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement