Advertisement
End_Wolf

Untitled

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