Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Converted with ttyyuu12345's model to script plugin v4
- function sandbox(var,func)
- local env = getfenv(func)
- local newenv = setmetatable({},{
- __index = function(self,k)
- if k=="script" then
- return var
- else
- return env[k]
- end
- end,
- })
- setfenv(func,newenv)
- return func
- end
- cors = {}
- mas = Instance.new("Model",game:GetService("Lighting"))
- Model0 = Instance.new("Model")
- Part1 = Instance.new("Part")
- Part2 = Instance.new("Part")
- Part3 = Instance.new("Part")
- Seat4 = Instance.new("Seat")
- Seat5 = Instance.new("Seat")
- Part6 = Instance.new("Part")
- Part7 = Instance.new("Part")
- CylinderMesh8 = Instance.new("CylinderMesh")
- Part9 = Instance.new("Part")
- Part10 = Instance.new("Part")
- Part11 = Instance.new("Part")
- CylinderMesh12 = Instance.new("CylinderMesh")
- Part13 = Instance.new("Part")
- Part14 = Instance.new("Part")
- Part15 = Instance.new("Part")
- Part16 = Instance.new("Part")
- Part17 = Instance.new("Part")
- SurfaceGui18 = Instance.new("SurfaceGui")
- Frame19 = Instance.new("Frame")
- Script20 = Instance.new("Script")
- Script21 = Instance.new("Script")
- Script22 = Instance.new("Script")
- Frame23 = Instance.new("Frame")
- Frame24 = Instance.new("Frame")
- Script25 = Instance.new("Script")
- TextLabel26 = Instance.new("TextLabel")
- TextLabel27 = Instance.new("TextLabel")
- TextLabel28 = Instance.new("TextLabel")
- TextLabel29 = Instance.new("TextLabel")
- TextLabel30 = Instance.new("TextLabel")
- IntValue31 = Instance.new("IntValue")
- IntValue32 = Instance.new("IntValue")
- TextButton33 = Instance.new("TextButton")
- TextButton34 = Instance.new("TextButton")
- TextButton35 = Instance.new("TextButton")
- TextButton36 = Instance.new("TextButton")
- TextLabel37 = Instance.new("TextLabel")
- TextLabel38 = Instance.new("TextLabel")
- TextLabel39 = Instance.new("TextLabel")
- Frame40 = Instance.new("Frame")
- Script41 = Instance.new("Script")
- TextButton42 = Instance.new("TextButton")
- TextButton43 = Instance.new("TextButton")
- ImageLabel44 = Instance.new("ImageLabel")
- Frame45 = Instance.new("Frame")
- ImageLabel46 = Instance.new("ImageLabel")
- TextButton47 = Instance.new("TextButton")
- Script48 = Instance.new("Script")
- Frame49 = Instance.new("Frame")
- ImageLabel50 = Instance.new("ImageLabel")
- Script51 = Instance.new("Script")
- Frame52 = Instance.new("Frame")
- ImageLabel53 = Instance.new("ImageLabel")
- Script54 = Instance.new("Script")
- SpotLight55 = Instance.new("SpotLight")
- Tool56 = Instance.new("Tool")
- LocalScript57 = Instance.new("LocalScript")
- ScreenGui58 = Instance.new("ScreenGui")
- Part59 = Instance.new("Part")
- Part60 = Instance.new("Part")
- Model0.Name = "Pong Machine"
- Model0.Parent = mas
- Part1.Parent = Model0
- Part1.Material = Enum.Material.Fabric
- Part1.BrickColor = BrickColor.new("Really blue")
- Part1.Rotation = Vector3.new(-15.5, -14.4799995, -3.97000003)
- Part1.Anchored = true
- Part1.FormFactor = Enum.FormFactor.Custom
- Part1.Size = Vector3.new(2.99999976, 3.60000038, 0.400000006)
- 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)
- Part1.FrontSurface = Enum.SurfaceType.Weld
- Part1.Color = Color3.new(0, 0, 1)
- Part1.Position = Vector3.new(49.5499992, 1.79043996, 54.1632233)
- Part1.Orientation = Vector3.new(-15, -15, 0)
- Part1.Color = Color3.new(0, 0, 1)
- Part2.Parent = Model0
- Part2.Material = Enum.Material.Fabric
- Part2.BrickColor = BrickColor.new("Bright red")
- Part2.Rotation = Vector3.new(-15.5, 14.4799995, 3.97000003)
- Part2.Anchored = true
- Part2.FormFactor = Enum.FormFactor.Custom
- Part2.Size = Vector3.new(2.99999976, 3.60000038, 0.400000006)
- 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)
- Part2.FrontSurface = Enum.SurfaceType.Weld
- Part2.Color = Color3.new(0.768628, 0.156863, 0.109804)
- Part2.Position = Vector3.new(43.4500008, 1.79043996, 54.1632233)
- Part2.Orientation = Vector3.new(-15, 15, 0)
- Part2.Color = Color3.new(0.768628, 0.156863, 0.109804)
- Part3.Parent = Model0
- Part3.Material = Enum.Material.DiamondPlate
- Part3.BrickColor = BrickColor.new("Dark stone grey")
- Part3.Anchored = true
- Part3.FormFactor = Enum.FormFactor.Custom
- Part3.Size = Vector3.new(9, 0.200000003, 9)
- Part3.CFrame = CFrame.new(46.5, 0.241914004, 58.5, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part3.TopSurface = Enum.SurfaceType.Smooth
- Part3.Color = Color3.new(0.388235, 0.372549, 0.384314)
- Part3.Position = Vector3.new(46.5, 0.241914004, 58.5)
- Part3.Color = Color3.new(0.388235, 0.372549, 0.384314)
- Seat4.Parent = Model0
- Seat4.Material = Enum.Material.Fabric
- Seat4.BrickColor = BrickColor.new("Really blue")
- Seat4.Rotation = Vector3.new(164.5, 14.4799995, -176.029999)
- Seat4.Size = Vector3.new(3, 1.20000005, 2)
- 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)
- Seat4.BackSurface = Enum.SurfaceType.Weld
- Seat4.TopSurface = Enum.SurfaceType.Smooth
- Seat4.Color = Color3.new(0, 0, 1)
- Seat4.Position = Vector3.new(49.1696167, 0.941911995, 55.58284)
- Seat4.Orientation = Vector3.new(15, 165, 0)
- Seat4.Color = Color3.new(0, 0, 1)
- Seat5.Parent = Model0
- Seat5.Material = Enum.Material.Fabric
- Seat5.BrickColor = BrickColor.new("Bright red")
- Seat5.Rotation = Vector3.new(164.5, -14.4799995, 176.029999)
- Seat5.Size = Vector3.new(3, 1.20000005, 2)
- 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)
- Seat5.BackSurface = Enum.SurfaceType.Weld
- Seat5.TopSurface = Enum.SurfaceType.Smooth
- Seat5.Color = Color3.new(0.768628, 0.156863, 0.109804)
- Seat5.Position = Vector3.new(43.8303833, 0.941911995, 55.58284)
- Seat5.Orientation = Vector3.new(15, -165, 0)
- Seat5.Color = Color3.new(0.768628, 0.156863, 0.109804)
- Part6.Name = "Speaker"
- Part6.Parent = Model0
- Part6.Material = Enum.Material.DiamondPlate
- Part6.BrickColor = BrickColor.new("Light stone grey")
- Part6.Anchored = true
- Part6.FormFactor = Enum.FormFactor.Custom
- Part6.Size = Vector3.new(1, 3.20000005, 2)
- Part6.CFrame = CFrame.new(46.5, 1.94191301, 62, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part6.TopSurface = Enum.SurfaceType.Smooth
- Part6.Color = Color3.new(0.898039, 0.894118, 0.87451)
- Part6.Position = Vector3.new(46.5, 1.94191301, 62)
- Part6.Color = Color3.new(0.898039, 0.894118, 0.87451)
- Part7.Parent = Model0
- Part7.Material = Enum.Material.DiamondPlate
- Part7.BrickColor = BrickColor.new("Mid gray")
- Part7.Anchored = true
- Part7.FormFactor = Enum.FormFactor.Custom
- Part7.Size = Vector3.new(0.400000036, 2, 2)
- Part7.CFrame = CFrame.new(43.2000008, 2.54190707, 62, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part7.Color = Color3.new(0.803922, 0.803922, 0.803922)
- Part7.Position = Vector3.new(43.2000008, 2.54190707, 62)
- Part7.Color = Color3.new(0.803922, 0.803922, 0.803922)
- CylinderMesh8.Parent = Part7
- Part9.Parent = Model0
- Part9.Material = Enum.Material.DiamondPlate
- Part9.BrickColor = BrickColor.new("Bright red")
- Part9.Anchored = true
- Part9.FormFactor = Enum.FormFactor.Custom
- Part9.Size = Vector3.new(2, 3.19999981, 2)
- Part9.CFrame = CFrame.new(45, 1.94191301, 62, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part9.TopSurface = Enum.SurfaceType.Smooth
- Part9.Color = Color3.new(0.768628, 0.156863, 0.109804)
- Part9.Position = Vector3.new(45, 1.94191301, 62)
- Part9.Color = Color3.new(0.768628, 0.156863, 0.109804)
- Part10.Parent = Model0
- Part10.Material = Enum.Material.DiamondPlate
- Part10.BrickColor = BrickColor.new("Really blue")
- Part10.Anchored = true
- Part10.FormFactor = Enum.FormFactor.Custom
- Part10.Size = Vector3.new(2, 3.20000005, 2)
- Part10.CFrame = CFrame.new(48, 1.94191301, 62, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part10.TopSurface = Enum.SurfaceType.Smooth
- Part10.Color = Color3.new(0, 0, 1)
- Part10.Position = Vector3.new(48, 1.94191301, 62)
- Part10.Color = Color3.new(0, 0, 1)
- Part11.Parent = Model0
- Part11.Material = Enum.Material.DiamondPlate
- Part11.BrickColor = BrickColor.new("Mid gray")
- Part11.Anchored = true
- Part11.FormFactor = Enum.FormFactor.Custom
- Part11.Size = Vector3.new(0.400000036, 2, 2)
- Part11.CFrame = CFrame.new(49.7999992, 2.54190707, 62, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part11.Color = Color3.new(0.803922, 0.803922, 0.803922)
- Part11.Position = Vector3.new(49.7999992, 2.54190707, 62)
- Part11.Color = Color3.new(0.803922, 0.803922, 0.803922)
- CylinderMesh12.Parent = Part11
- Part13.Parent = Model0
- Part13.Material = Enum.Material.DiamondPlate
- Part13.Anchored = true
- Part13.FormFactor = Enum.FormFactor.Custom
- Part13.Size = Vector3.new(2, 1.20000005, 2)
- Part13.CFrame = CFrame.new(43, 0.941911995, 62, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part13.TopSurface = Enum.SurfaceType.Smooth
- Part13.Position = Vector3.new(43, 0.941911995, 62)
- Part14.Parent = Model0
- Part14.Material = Enum.Material.DiamondPlate
- Part14.Anchored = true
- Part14.FormFactor = Enum.FormFactor.Custom
- Part14.Size = Vector3.new(2, 1.20000005, 2)
- Part14.CFrame = CFrame.new(50, 0.941911995, 62, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part14.TopSurface = Enum.SurfaceType.Smooth
- Part14.Position = Vector3.new(50, 0.941911995, 62)
- Part15.Parent = Model0
- Part15.Material = Enum.Material.DiamondPlate
- Part15.BrickColor = BrickColor.new("Dark stone grey")
- Part15.Anchored = true
- Part15.FormFactor = Enum.FormFactor.Custom
- Part15.Size = Vector3.new(7.39999962, 0.200000003, 2)
- Part15.CFrame = CFrame.new(46.5, 3.64190602, 62.1999969, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part15.TopSurface = Enum.SurfaceType.Smooth
- Part15.Color = Color3.new(0.388235, 0.372549, 0.384314)
- Part15.Position = Vector3.new(46.5, 3.64190602, 62.1999969)
- Part15.Color = Color3.new(0.388235, 0.372549, 0.384314)
- Part16.Parent = Model0
- Part16.Material = Enum.Material.DiamondPlate
- Part16.BrickColor = BrickColor.new("Light stone grey")
- Part16.Rotation = Vector3.new(-15, 0, 90)
- Part16.Anchored = true
- Part16.FormFactor = Enum.FormFactor.Custom
- Part16.Size = Vector3.new(6.20000076, 0.200000003, 0.999999821)
- Part16.CFrame = CFrame.new(42.9000015, 6.63849306, 61.2741165, 0, -0.99999994, 0, 0.965925753, 0, 0.258819014, -0.258819014, 0, 0.965925694)
- Part16.TopSurface = Enum.SurfaceType.Smooth
- Part16.Color = Color3.new(0.898039, 0.894118, 0.87451)
- Part16.Position = Vector3.new(42.9000015, 6.63849306, 61.2741165)
- Part16.Orientation = Vector3.new(-15, 0, 90)
- Part16.Color = Color3.new(0.898039, 0.894118, 0.87451)
- Part17.Name = "screen"
- Part17.Parent = Model0
- Part17.BrickColor = BrickColor.new("Really black")
- Part17.Rotation = Vector3.new(-15, 0, 0)
- Part17.Anchored = true
- Part17.FormFactor = Enum.FormFactor.Custom
- Part17.Size = Vector3.new(7, 6, 0.200000003)
- Part17.CFrame = CFrame.new(46.5, 6.54190302, 61.3000031, 1, 0, 0, 0, 0.965925813, 0.258819044, 0, -0.258819044, 0.965925813)
- Part17.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
- Part17.Position = Vector3.new(46.5, 6.54190302, 61.3000031)
- Part17.Orientation = Vector3.new(-15, 0, 0)
- Part17.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
- SurfaceGui18.Name = "Game"
- SurfaceGui18.Parent = Part17
- Frame19.Name = "Game"
- Frame19.Parent = SurfaceGui18
- Frame19.Transparency = 1
- Frame19.Size = UDim2.new(1, 0, 1, 0)
- Frame19.Visible = false
- Frame19.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame19.BackgroundTransparency = 1
- Script20.Name = "Controls"
- Script20.Parent = Frame19
- table.insert(cors,sandbox(Script20,function()
- B = script.Parent.GAME.BluPdl
- R = script.Parent.GAME.RedPdl
- script.Parent.UpRed.MouseButton1Click:connect(function()
- print("UpRed")
- if R.Position.Y.Offset > 0 then
- R.Position = UDim2.new(0, 560, 0, (R.Position.Y.Offset - 20))
- end
- end)
- script.Parent.DownRed.MouseButton1Click:connect(function()
- print("DownRed")
- if R.Position.Y.Offset < 400 then
- R.Position = UDim2.new(0, 560, 0, (R.Position.Y.Offset + 20))
- end
- end)
- script.Parent.UpBlu.MouseButton1Click:connect(function()
- print("UpBlu")
- if B.Position.Y.Offset > 0 then
- B.Position = UDim2.new(0, 0, 0, (B.Position.Y.Offset - 20))
- end
- end)
- script.Parent.DownBlu.MouseButton1Click:connect(function()
- print("DownBlu")
- if B.Position.Y.Offset < 400 then
- B.Position = UDim2.new(0, 0, 0, (B.Position.Y.Offset + 20))
- end
- end)
- end))
- Script21.Name = "Initialize"
- Script21.Parent = Frame19
- table.insert(cors,sandbox(Script21,function()
- script.Parent.GAME.BluPdl.Position = UDim2.new(0,0,0,200)
- script.Parent.GAME.RedPdl.Position = UDim2.new(0,560,0,200)
- script.Parent.GAME.Ball.Visible = false
- script.Parent.GAME.Ball.Position = UDim2.new (0, 290, 0, 250)
- script.Parent.GAME.Ready.Text = "3"
- script.Parent.GAME.Ready.Visible = true
- script.Parent.GAME.bScore.Visible = false
- script.Parent.GAME.rScore.Visible = false
- wait(1)
- script.Parent.GAME.Ready.Text = "2"
- script.Parent.GAME.Ball.Position = UDim2.new (0, 290, 0, 250)
- wait(1)
- script.Parent.GAME.Ready.Text = "1"
- script.Parent.GAME.Ball.Position = UDim2.new (0, 290, 0, 250)
- wait(1)
- script.Parent.GAME.Ready.Text = "GO"
- script.Parent.GAME.Ball.Position = UDim2.new (0, 290, 0, 250)
- wait(1)
- script.Parent.GAME.Ready.Visible = false
- script.Parent.GAME.Ready.Text = "3"
- script.Parent.GAME.Ball.Visible = true
- script.Parent.GAME.Ball.Position = UDim2.new (0, 90, 0, 250)
- script.Parent.GAME.BluScore.Value = 0
- script.Parent.GAME.RedScore.Value = 0
- script.Parent.Parent.Game.GAME.Ball.Movement.Disabled = true
- script.Parent.Parent.Game.GAME.Ball.Movement.Disabled = false
- end))
- Script22.Name = "ScoreDisplay"
- Script22.Parent = Frame19
- table.insert(cors,sandbox(Script22,function()
- R = script.Parent.GAME.RedScore
- B = script.Parent.GAME.BluScore
- Rd = script.Parent.ScoreRed
- Bd = script.Parent.ScoreBlu
- R.Changed:connect(function()
- Rd.Text = "Score: " .. R.Value
- if R.Value == 300 then
- script.Parent.Parent.RedWins.Active = true
- script.Parent.Parent.RedWins.Visible = true
- script.Parent.Parent.RedWins.Script.Disabled = true
- script.Parent.Parent.RedWins.Script.Disabled = false
- script.Parent.Visible = false
- script.Parent.Active = false
- end
- end)
- B.Changed:connect(function()
- Bd.Text = "Score: " .. B.Value
- if B.Value == 300 then
- script.Parent.Parent.BlueWins.Active = true
- script.Parent.Parent.BlueWins.Visible = true
- script.Parent.Parent.BlueWins.Script.Disabled = true
- script.Parent.Parent.BlueWins.Script.Disabled = false
- script.Parent.Visible = false
- script.Parent.Active = false
- end
- end)
- end))
- Frame23.Name = "GAME"
- Frame23.Parent = Frame19
- Frame23.Size = UDim2.new(0, 580, 0, 500)
- Frame23.Position = UDim2.new(0, 110, 0, 85)
- Frame23.BackgroundColor3 = Color3.new(0, 0, 0)
- Frame23.BorderColor3 = Color3.new(0.333333, 1, 0)
- Frame23.BorderSizePixel = 10
- Frame24.Name = "Ball"
- Frame24.Parent = Frame23
- Frame24.Size = UDim2.new(0, 20, 0, 20)
- Frame24.Position = UDim2.new(0, 490, 0, 250)
- Frame24.Visible = false
- Frame24.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame24.BorderColor3 = Color3.new(1, 1, 0)
- Frame24.BorderSizePixel = 3
- Script25.Name = "Movement"
- Script25.Parent = Frame24
- Script25.Disabled = true
- table.insert(cors,sandbox(Script25,function()
- B = script.Parent
- Pr = script.Parent.Parent.RedPdl
- Pb = script.Parent.Parent.BluPdl
- Vy = 5
- Vx = 8
- script.Changed:connect(function()
- while true do
- wait(0.03)
- math.randomseed(tick())
- if B.Position.Y.Offset <= 10 then
- Vy = 5 + ((math.random()+0.3)*10)
- end
- if B.Position.Y.Offset >= 480 then
- Vy = -5 - ((math.random()+0.3)*10)
- end
- --Oh ho ho ho, here goes the paddling system
- --RED PADDLES
- if B.Position.X.Offset >= 540 then
- if B.Position.Y.Offset > (Pr.Position.Y.Offset - 20) and B.Position.Y.Offset < (Pr.Position.Y.Offset + 30) then
- Vx = -8
- Vy = -5 - ((math.random()+0.3)*10)
- end
- if B.Position.Y.Offset >= (Pr.Position.Y.Offset + 30) and B.Position.Y.Offset < (Pr.Position.Y.Offset + 100) then
- Vx = -8
- Vy = 5 + ((math.random()+0.3)*10)
- end
- end
- --BLUE PADDLES
- if B.Position.X.Offset <= 20 then
- if B.Position.Y.Offset > (Pb.Position.Y.Offset - 20) and B.Position.Y.Offset < (Pb.Position.Y.Offset + 30) then
- Vx = 8
- Vy = -5 - ((math.random()+0.3)*10)
- end
- if B.Position.Y.Offset >= (Pb.Position.Y.Offset + 30) and B.Position.Y.Offset < (Pb.Position.Y.Offset + 100) then
- Vx = 8
- Vy = 5 + ((math.random()+0.3)*10)
- end
- end
- --SCORING
- --RED SIDE ( BLUE SCORES )
- if B.Position.X.Offset >= 560 then
- B.Visible = false
- Vx = -8
- Vy = -5 - ((math.random()+0.3)*10)
- B.Position = UDim2.new (0, 490, 0, 250)
- script.Parent.Parent.bScore.Visible = true
- wait(1)
- script.Parent.Parent.bScore.Visible = false
- wait(0.2)
- script.Parent.Parent.bScore.Visible = true
- wait(1)
- script.Parent.Parent.bScore.Visible = false
- wait(1)
- script.Parent.Parent.BluScore.Value = (script.Parent.Parent.BluScore.Value + 100)
- if script.Parent.Parent.BluScore.Value == 300 then
- break
- end
- script.Parent.Parent.Ready.Visible = true
- wait(1)
- script.Parent.Parent.Ready.Text = "2"
- wait(1)
- script.Parent.Parent.Ready.Text = "1"
- wait(1)
- script.Parent.Parent.Ready.Text = "GO"
- wait(1)
- script.Parent.Parent.Ready.Visible = false
- script.Parent.Parent.Ready.Text = "3"
- B.Visible = true
- end
- --BLU SIDE ( RED SCORES )
- if B.Position.X.Offset <= 0 then
- B.Visible = false
- Vx = 8
- Vy = 5 + ((math.random()+0.3)*10)
- B.Position = UDim2.new (0, 90, 0, 250)
- script.Parent.Parent.rScore.Visible = true
- wait(1)
- script.Parent.Parent.rScore.Visible = false
- wait(0.2)
- script.Parent.Parent.rScore.Visible = true
- wait(1)
- script.Parent.Parent.rScore.Visible = false
- wait(1)
- script.Parent.Parent.RedScore.Value = (script.Parent.Parent.RedScore.Value + 100)
- if script.Parent.Parent.RedScore.Value == 300 then
- break
- end
- script.Parent.Parent.Ready.Visible = true
- wait(1)
- script.Parent.Parent.Ready.Text = "2"
- wait(1)
- script.Parent.Parent.Ready.Text = "1"
- wait(1)
- script.Parent.Parent.Ready.Text = "GO"
- wait(1)
- script.Parent.Parent.Ready.Visible = false
- script.Parent.Parent.Ready.Text = "3"
- B.Visible = true
- end
- B.Position = UDim2.new(0, (B.Position.X.Offset + Vx), 0, (B.Position.Y.Offset + Vy))
- if script.Parent.Parent.BluScore.Value == 300 then
- break
- end
- if script.Parent.Parent.RedScore.Value == 300 then
- break
- end
- end
- end)
- end))
- TextLabel26.Name = "RedPdl"
- TextLabel26.Parent = Frame23
- TextLabel26.Size = UDim2.new(0, 20, 0, 100)
- TextLabel26.Text = ""
- TextLabel26.Position = UDim2.new(0, 560, 0, 260)
- TextLabel26.BackgroundColor3 = Color3.new(1, 0, 0)
- TextLabel26.BorderColor3 = Color3.new(1, 0, 0)
- TextLabel26.Font = Enum.Font.SourceSans
- TextLabel26.FontSize = Enum.FontSize.Size14
- TextLabel27.Name = "BluPdl"
- TextLabel27.Parent = Frame23
- TextLabel27.Size = UDim2.new(0, 20, 0, 100)
- TextLabel27.Text = ""
- TextLabel27.Position = UDim2.new(0, 0, 0, 340)
- TextLabel27.BackgroundColor3 = Color3.new(0, 0.333333, 1)
- TextLabel27.BorderColor3 = Color3.new(0, 0.333333, 1)
- TextLabel27.Font = Enum.Font.SourceSans
- TextLabel27.FontSize = Enum.FontSize.Size14
- TextLabel28.Name = "bScore"
- TextLabel28.Parent = Frame23
- TextLabel28.Transparency = 0.5
- TextLabel28.Size = UDim2.new(0, 400, 0, 100)
- TextLabel28.Text = "Blue Scores!"
- TextLabel28.Position = UDim2.new(0.5, -200, 0, 0)
- TextLabel28.Visible = false
- TextLabel28.BackgroundColor3 = Color3.new(0, 0.666667, 1)
- TextLabel28.BackgroundTransparency = 0.5
- TextLabel28.Font = Enum.Font.SourceSans
- TextLabel28.FontSize = Enum.FontSize.Size48
- TextLabel28.TextColor3 = Color3.new(1, 1, 1)
- TextLabel28.TextStrokeTransparency = 0
- TextLabel29.Name = "rScore"
- TextLabel29.Parent = Frame23
- TextLabel29.Transparency = 0.5
- TextLabel29.Size = UDim2.new(0, 400, 0, 100)
- TextLabel29.Text = "Red Scores!"
- TextLabel29.Position = UDim2.new(0.5, -200, 0, 400)
- TextLabel29.Visible = false
- TextLabel29.BackgroundColor3 = Color3.new(1, 0, 0)
- TextLabel29.BackgroundTransparency = 0.5
- TextLabel29.Font = Enum.Font.SourceSans
- TextLabel29.FontSize = Enum.FontSize.Size48
- TextLabel29.TextColor3 = Color3.new(1, 1, 1)
- TextLabel29.TextStrokeTransparency = 0
- TextLabel30.Name = "Ready"
- TextLabel30.Parent = Frame23
- TextLabel30.Transparency = 1
- TextLabel30.Size = UDim2.new(0, 100, 0, 100)
- TextLabel30.Text = "3"
- TextLabel30.Position = UDim2.new(0.5, -50, 0.5, -50)
- TextLabel30.Visible = false
- TextLabel30.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel30.BackgroundTransparency = 1
- TextLabel30.Font = Enum.Font.SourceSansBold
- TextLabel30.FontSize = Enum.FontSize.Size48
- TextLabel30.TextColor3 = Color3.new(1, 1, 1)
- TextLabel30.TextWrapped = true
- IntValue31.Name = "BluScore"
- IntValue31.Parent = Frame23
- IntValue31.Value = 300
- IntValue32.Name = "RedScore"
- IntValue32.Parent = Frame23
- TextButton33.Name = "DownBlu"
- TextButton33.Parent = Frame19
- TextButton33.Size = UDim2.new(0, 80, 0, 100)
- TextButton33.Text = "Dn"
- TextButton33.Position = UDim2.new(0, 10, 0, 480)
- TextButton33.BackgroundColor3 = Color3.new(0, 0.666667, 1)
- TextButton33.Font = Enum.Font.ArialBold
- TextButton33.FontSize = Enum.FontSize.Size48
- TextButton34.Name = "DownRed"
- TextButton34.Parent = Frame19
- TextButton34.Size = UDim2.new(0, 80, 0, 100)
- TextButton34.Text = "Dn"
- TextButton34.Position = UDim2.new(0, 710, 0, 480)
- TextButton34.BackgroundColor3 = Color3.new(1, 0, 0)
- TextButton34.Font = Enum.Font.ArialBold
- TextButton34.FontSize = Enum.FontSize.Size48
- TextButton35.Name = "UpBlu"
- TextButton35.Parent = Frame19
- TextButton35.Size = UDim2.new(0, 80, 0, 100)
- TextButton35.Text = "Up"
- TextButton35.Position = UDim2.new(0, 10, 0, 80)
- TextButton35.BackgroundColor3 = Color3.new(0, 0.666667, 1)
- TextButton35.Font = Enum.Font.ArialBold
- TextButton35.FontSize = Enum.FontSize.Size48
- TextButton36.Name = "UpRed"
- TextButton36.Parent = Frame19
- TextButton36.Size = UDim2.new(0, 80, 0, 100)
- TextButton36.Text = "Up"
- TextButton36.Position = UDim2.new(0, 710, 0, 80)
- TextButton36.BackgroundColor3 = Color3.new(1, 0, 0)
- TextButton36.Font = Enum.Font.ArialBold
- TextButton36.FontSize = Enum.FontSize.Size48
- TextLabel37.Name = "BG"
- TextLabel37.Parent = Frame19
- TextLabel37.Transparency = 1
- TextLabel37.Size = UDim2.new(0, 600, 0, 500)
- TextLabel37.Text = ""
- TextLabel37.Position = UDim2.new(0, 100, 0, 80)
- TextLabel37.BackgroundColor3 = Color3.new(0, 0, 0)
- TextLabel37.BackgroundTransparency = 1
- TextLabel37.BorderColor3 = Color3.new(0, 1, 0)
- TextLabel37.BorderSizePixel = 5
- TextLabel37.Font = Enum.Font.SourceSans
- TextLabel37.FontSize = Enum.FontSize.Size14
- TextLabel38.Name = "ScoreBlu"
- TextLabel38.Parent = Frame19
- TextLabel38.Transparency = 1
- TextLabel38.Size = UDim2.new(0, 100, 0, 100)
- TextLabel38.Text = "Score: 300"
- TextLabel38.Position = UDim2.new(0, 100, 0, 0)
- TextLabel38.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel38.BackgroundTransparency = 1
- TextLabel38.Font = Enum.Font.SourceSans
- TextLabel38.FontSize = Enum.FontSize.Size48
- TextLabel38.TextColor3 = Color3.new(0, 0.333333, 1)
- TextLabel39.Name = "ScoreRed"
- TextLabel39.Parent = Frame19
- TextLabel39.Transparency = 1
- TextLabel39.Size = UDim2.new(0, 100, 0, 100)
- TextLabel39.Text = "Score: 0"
- TextLabel39.Position = UDim2.new(0, 580, 0, 0)
- TextLabel39.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel39.BackgroundTransparency = 1
- TextLabel39.Font = Enum.Font.SourceSans
- TextLabel39.FontSize = Enum.FontSize.Size48
- TextLabel39.TextColor3 = Color3.new(1, 0, 0)
- Frame40.Name = "StartScreen"
- Frame40.Parent = SurfaceGui18
- Frame40.Transparency = 1
- Frame40.Size = UDim2.new(1, 0, 1, 0)
- Frame40.Active = true
- Frame40.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame40.BackgroundTransparency = 1
- Script41.Parent = Frame40
- table.insert(cors,sandbox(Script41,function()
- script.Parent.Start.MouseButton1Click:connect(function()
- print("Game Start")
- script.Parent.Parent.Game.Active = true
- script.Parent.Parent.Game.Visible = true
- script.Parent.Parent.Game.Initialize.Disabled = true
- script.Parent.Parent.Game.Initialize.Disabled = false
- script.Parent.Parent.Game.GAME.Ball.Movement.Disabled = false
- script.Parent.Visible = false
- script.Parent.Active = false
- end)
- script.Parent.HowToPlay.MouseButton1Click:connect(function()
- print("Game Start")
- script.Parent.Parent.HowToPlay.Active = true
- script.Parent.Parent.HowToPlay.Visible = true
- script.Parent.Visible = false
- script.Parent.Active = false
- end)
- end))
- TextButton42.Name = "HowToPlay"
- TextButton42.Parent = Frame40
- TextButton42.Size = UDim2.new(0, 300, 0, 100)
- TextButton42.Text = "HOW TO PLAY"
- TextButton42.Position = UDim2.new(0.700000048, -150, 0.699999988, 0)
- TextButton42.BackgroundColor3 = Color3.new(0, 0, 0)
- TextButton42.BorderColor3 = Color3.new(0.333333, 1, 1)
- TextButton42.BorderSizePixel = 10
- TextButton42.Font = Enum.Font.SourceSansBold
- TextButton42.FontSize = Enum.FontSize.Size48
- TextButton42.TextColor3 = Color3.new(1, 1, 1)
- TextButton43.Name = "Start"
- TextButton43.Parent = Frame40
- TextButton43.Size = UDim2.new(0, 300, 0, 100)
- TextButton43.Text = "START"
- TextButton43.Position = UDim2.new(0.300000012, -150, 0.699999988, 0)
- TextButton43.BackgroundColor3 = Color3.new(0, 0, 0)
- TextButton43.BorderColor3 = Color3.new(0, 0.333333, 1)
- TextButton43.BorderSizePixel = 10
- TextButton43.Font = Enum.Font.SourceSansBold
- TextButton43.FontSize = Enum.FontSize.Size48
- TextButton43.TextColor3 = Color3.new(1, 1, 1)
- TextButton43.TextWrapped = true
- ImageLabel44.Parent = Frame40
- ImageLabel44.Transparency = 1
- ImageLabel44.Size = UDim2.new(1, -100, 1, -200)
- ImageLabel44.Position = UDim2.new(0, 50, 0, 0)
- ImageLabel44.BackgroundColor3 = Color3.new(1, 1, 1)
- ImageLabel44.BackgroundTransparency = 1
- ImageLabel44.Image = "http://www.roblox.com/asset/?id=139116259"
- Frame45.Name = "HowToPlay"
- Frame45.Parent = SurfaceGui18
- Frame45.Transparency = 1
- Frame45.Size = UDim2.new(1, 0, 1, 0)
- Frame45.Visible = false
- Frame45.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame45.BackgroundTransparency = 1
- ImageLabel46.Parent = Frame45
- ImageLabel46.Transparency = 1
- ImageLabel46.Size = UDim2.new(1, -100, 1, -200)
- ImageLabel46.Position = UDim2.new(0, 50, 0, 0)
- ImageLabel46.BackgroundColor3 = Color3.new(1, 1, 1)
- ImageLabel46.BackgroundTransparency = 1
- ImageLabel46.Image = "http://www.roblox.com/asset/?id=139120696"
- TextButton47.Name = "Done"
- TextButton47.Parent = Frame45
- TextButton47.Size = UDim2.new(0, 300, 0, 100)
- TextButton47.Text = "OK"
- TextButton47.Position = UDim2.new(0.5, -150, 0.699999988, 0)
- TextButton47.BackgroundColor3 = Color3.new(0, 0, 0)
- TextButton47.BorderColor3 = Color3.new(0, 0.333333, 1)
- TextButton47.BorderSizePixel = 10
- TextButton47.Font = Enum.Font.SourceSansBold
- TextButton47.FontSize = Enum.FontSize.Size48
- TextButton47.TextColor3 = Color3.new(1, 1, 1)
- TextButton47.TextWrapped = true
- Script48.Parent = Frame45
- table.insert(cors,sandbox(Script48,function()
- script.Parent.Done.MouseButton1Click:connect(function()
- script.Parent.Parent.StartScreen.Active = true
- script.Parent.Parent.StartScreen.Visible = true
- script.Parent.Visible = false
- script.Parent.Active = false
- end)
- end))
- Frame49.Name = "RedWins"
- Frame49.Parent = SurfaceGui18
- Frame49.Transparency = 1
- Frame49.Size = UDim2.new(1, 0, 1, 0)
- Frame49.Visible = false
- Frame49.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame49.BackgroundTransparency = 1
- ImageLabel50.Parent = Frame49
- ImageLabel50.Transparency = 1
- ImageLabel50.Size = UDim2.new(1, -100, 1, -100)
- ImageLabel50.Position = UDim2.new(0, 50, 0, 50)
- ImageLabel50.BackgroundColor3 = Color3.new(1, 1, 1)
- ImageLabel50.BackgroundTransparency = 1
- ImageLabel50.Image = "http://www.roblox.com/asset/?id=139120645"
- Script51.Parent = Frame49
- table.insert(cors,sandbox(Script51,function()
- wait(5)
- script.Parent.Parent.Game.GAME.Ball.Movement.Disabled = true
- script.Parent.Visible = false
- script.Parent.Active = false
- script.Parent.Parent.StartScreen.Active = true
- script.Parent.Parent.StartScreen.Visible = true
- end))
- Frame52.Name = "BlueWins"
- Frame52.Parent = SurfaceGui18
- Frame52.Transparency = 1
- Frame52.Size = UDim2.new(1, 0, 1, 0)
- Frame52.Visible = false
- Frame52.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame52.BackgroundTransparency = 1
- ImageLabel53.Parent = Frame52
- ImageLabel53.Transparency = 1
- ImageLabel53.Size = UDim2.new(1, -100, 1, -100)
- ImageLabel53.Position = UDim2.new(0, 50, 0, 50)
- ImageLabel53.BackgroundColor3 = Color3.new(1, 1, 1)
- ImageLabel53.BackgroundTransparency = 1
- ImageLabel53.Image = "http://www.roblox.com/asset/?id=139120623"
- Script54.Parent = Frame52
- table.insert(cors,sandbox(Script54,function()
- wait(5)
- script.Parent.Parent.Game.GAME.Ball.Movement.Disabled = true
- script.Parent.Visible = false
- script.Parent.Active = false
- script.Parent.Parent.StartScreen.Active = true
- script.Parent.Parent.StartScreen.Visible = true
- end))
- SpotLight55.Parent = Part17
- Tool56.Name = "2DGame"
- Tool56.Parent = Model0
- Tool56.TextureId = "http://www.roblox.com/asset/?id=33681144"
- Tool56.GripForward = Vector3.new(-0, 0.707106769, -0.707106769)
- Tool56.GripPos = Vector3.new(0.300000012, -0.5, 0)
- Tool56.GripUp = Vector3.new(0, 0.707106769, 0.707106769)
- LocalScript57.Parent = Tool56
- table.insert(cors,sandbox(LocalScript57,function()
- local Tool = script.Parent
- local gui = nil
- local mapParts = {}
- local player = nil
- local keyDownCon = nil
- local keyUpCon = nil
- local clickCon = nil
- local platforming = false
- local time = 0
- local gaming = true
- local head = nil
- local left = false
- local right = false
- local jump = false
- local prize = nil
- local prizeRegenTimer = 0
- local walkCounter = 0
- local playerWalkForward = {"32171523","32171543","32171566","32171582","32171594"}
- local playerWalkBackward = {"32168430","32168450","32168470","32168483","32168492"}
- local playerVelocity = Vector2.new(0,0)
- function onEquipped(mouse)
- Tool.Handle.Song:Stop()
- Tool.Handle.Jump:Stop()
- Tool.Handle.Prize:Stop()
- Tool.Handle.Fail:Stop()
- enabled = false
- gui = Tool.GameGui:clone()
- player = gui.Cabinet.Screen.Player
- mapParts = gui.Cabinet.Screen.Map:GetChildren()
- keyDownCon = mouse.KeyDown:connect(onKeyDown)
- keyUpCon = mouse.KeyUp:connect(onKeyUp)
- clickCon = gui.Cabinet.SoundOnOff.MouseButton1Click:connect(soundChanger)
- if Tool.Handle.Song.Volume == 0 then
- gui.Cabinet.SoundOnOff.Image = "http://www.roblox.com/asset/?id=32203595"
- else
- gui.Cabinet.SoundOnOff.Image = "http://www.roblox.com/asset/?id=32203454"
- end
- head = Tool.Parent:FindFirstChild("Head")
- end
- Tool.Equipped:connect(onEquipped)
- function onUnequipped()
- gaming = false
- head.Anchored = false
- Tool.Handle.Song:Stop()
- Tool.Handle.Jump:Stop()
- Tool.Handle.Prize:Stop()
- Tool.Handle.Fail:Stop()
- game.Workspace.CurrentCamera.CameraType = 5
- gui:remove()
- keyDownCon:disconnect()
- keyUpCon:disconnect()
- clickCon:disconnect()
- clickCon = nil
- keyDownCon = nil
- keyUpCon = nil
- end
- Tool.Unequipped:connect(onUnequipped)
- local enabled = false
- function onActivated()
- if enabled then return end
- enabled = true
- game.Workspace.CurrentCamera.CameraType = 1
- head.Anchored = true
- prize = nil
- prizeRegenTimer = 0
- time = 0
- gui.Parent = game.Players:GetPlayerFromCharacter(Tool.Parent).PlayerGui
- Tool.Handle.Song:Play()
- gameLoop()
- Tool.Handle.Song:Stop()
- gui:remove()
- gui = Tool.GameGui:clone()
- clickCon = gui.Cabinet.SoundOnOff.MouseButton1Click:connect(soundChanger)
- if Tool.Handle.Song.Volume == 0 then
- gui.Cabinet.SoundOnOff.Image = "http://www.roblox.com/asset/?id=32203595"
- else
- gui.Cabinet.SoundOnOff.Image = "http://www.roblox.com/asset/?id=32203454"
- end
- player = gui.Cabinet.Screen.Player
- mapParts = gui.Cabinet.Screen.Map:GetChildren()
- game.Workspace.CurrentCamera.CameraType = 5
- head.Anchored = false
- enabled = false
- end
- Tool.Activated:connect(onActivated)
- function soundChanger()
- if gui.Cabinet.SoundOnOff.Image == "http://www.roblox.com/asset/?id=32203454" then
- gui.Cabinet.SoundOnOff.Image = "http://www.roblox.com/asset/?id=32203595"
- Tool.Handle.Song.Volume = 0
- Tool.Handle.Jump.Volume = 0
- Tool.Handle.Prize.Volume = 0
- Tool.Handle.Fail.Volume = 0
- else
- gui.Cabinet.SoundOnOff.Image = "http://www.roblox.com/asset/?id=32203454"
- Tool.Handle.Song.Volume = 0.5
- Tool.Handle.Jump.Volume = 0.5
- Tool.Handle.Prize.Volume = 0.5
- Tool.Handle.Fail.Volume = 0.5
- end
- end
- function onKeyDown(key)
- key:lower()
- if key == "a" then
- left = true
- right = false
- elseif key == "d" then
- left = false
- right = true
- elseif key == "w" then
- jump = true
- end
- end
- function onKeyUp(key)
- key:lower()
- if key == "a" then
- left = false
- elseif key == "d" then
- right = false
- elseif key == "w" then
- jump = false
- end
- end
- function Physics()
- if playerVelocity.y < 8 then
- playerVelocity = Vector2.new(playerVelocity.x,playerVelocity.y + 1)
- end
- if playerVelocity.y > 1 then
- platforming = false
- end
- local enemies = gui.Cabinet.Screen.Enemies:GetChildren()
- for i = 1, #enemies do
- enemies[i].Position = UDim2.new(0,enemies[i].Position.X.Offset,0,enemies[i].Position.Y.Offset + 5)
- end
- end
- function Touching(a,b)
- local ap = Vector2.new(a.Position.X.Offset, a.Position.Y.Offset)
- local as = Vector2.new(a.Size.X.Offset, a.Size.Y.Offset)
- local bp = Vector2.new(b.Position.X.Offset, b.Position.Y.Offset)
- local bs = Vector2.new(b.Size.X.Offset, b.Size.Y.Offset)
- 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)
- if c then
- return true
- else
- return false
- end
- end
- function Collision()
- -- check player against map
- for i = 1, #mapParts do
- if Touching(mapParts[i],player) then
- if player.Position.X.Offset < mapParts[i].Position.X.Offset and not platforming then
- player.Position = UDim2.new(0, mapParts[i].Position.X.Offset - player.Size.X.Offset,0,player.Position.Y.Offset)
- playerVelocity = Vector2.new(0,playerVelocity.y)
- elseif player.Position.X.Offset + player.Size.X.Offset > mapParts[i].Position.X.Offset + mapParts[i].Size.X.Offset and not platforming then
- player.Position = UDim2.new(0, mapParts[i].Position.X.Offset + mapParts[i].Size.X.Offset,0,player.Position.Y.Offset)
- playerVelocity = Vector2.new(0,playerVelocity.y)
- else
- if player.Position.Y.Offset > mapParts[i].Position.Y.Offset then
- playerVelocity = Vector2.new(playerVelocity.x,10)
- platforming = false
- elseif player.Position.Y.Offset + player.Size.Y.Offset > mapParts[i].Position.Y.Offset then
- platforming = true
- playerVelocity = Vector2.new(playerVelocity.x,0)
- end
- end
- end
- end
- -- check enemies against map, player
- local enemies = gui.Cabinet.Screen.Enemies:GetChildren()
- for i = 1, #enemies do
- for j = 1, #mapParts do
- if Touching(mapParts[j],enemies[i]) then
- enemies[i].Position = UDim2.new(0,enemies[i].Position.X.Offset,0,mapParts[j].Position.Y.Offset - enemies[i].Size.Y.Offset)
- end
- end
- if enemies[i].Position.X.Offset > 384 or enemies[i].Position.X.Offset < 0 then
- if enemies[i].Position.Y.Offset > 230 then
- enemies[i]:remove()
- else
- enemies[i].Left.Value = not enemies[i].Left.Value
- end
- end
- if Touching(enemies[i],player) then
- gaming = false
- end
- end
- -- check game bounds
- if player.Position.X.Offset < 0 then
- playerVelocity = Vector2.new(0,playerVelocity.y)
- player.Position = UDim2.new(0,0,0,player.Position.Y.Offset)
- elseif player.Position.X.Offset > 384 then
- playerVelocity = Vector2.new(0,playerVelocity.y)
- player.Position = UDim2.new(0,384,0,player.Position.Y.Offset)
- end
- if player.Position.Y.Offset < 0 then
- playerVelocity = Vector2.new(playerVelocity.x,0)
- player.Position = UDim2.new(0,player.Position.X.Offset,0,0)
- end
- -- check player against prize
- if prize ~= nil and Touching(player,prize) then
- time = time + 100
- Tool.Handle.Prize:Play()
- prize:remove()
- prize = nil
- prizeRegenTimer = math.random(180,360)
- end
- end
- function updatePlayerPos()
- if math.abs(playerVelocity.x) > 4 then
- if playerVelocity.x < 0 then
- playerVelocity = Vector2.new(-4,playerVelocity.y)
- else
- playerVelocity = Vector2.new(4,playerVelocity.y)
- end
- end
- player.Position = UDim2.new(0,player.Position.X.Offset + playerVelocity.x,0,player.Position.Y.Offset + playerVelocity.y)
- playerVelocity = Vector2.new(playerVelocity.x * 0.5,playerVelocity.y * 0.9)
- end
- function Controls()
- if left then
- playerVelocity = Vector2.new(playerVelocity.x - 3,playerVelocity.y)
- elseif right then
- playerVelocity = Vector2.new(playerVelocity.x + 3,playerVelocity.y)
- end
- if jump and platforming then
- jump = false
- platforming = false
- Tool.Handle.Jump:Play()
- playerVelocity = Vector2.new(playerVelocity.x,playerVelocity.y - 20)
- end
- end
- function walkAnimation(forward)
- walkCounter = walkCounter + 1
- if walkCounter > 8 then
- walkCounter = 1
- end
- local playIndex = walkCounter
- if walkCounter == 4 then
- playIndex = 2
- elseif walkCounter == 5 then
- playIndex = 1
- elseif walkCounter == 6 then
- playIndex = 4
- elseif walkCounter == 7 then
- playIndex = 5
- elseif walkCounter == 8 then
- playIndex = 4
- end
- if forward then
- player.Image = "http://www.roblox.com/asset/?id=" .. playerWalkForward[playIndex]
- else
- player.Image = "http://www.roblox.com/asset/?id=" .. playerWalkBackward[playIndex]
- end
- end
- local forward = true
- function animation()
- if playerVelocity.x > 1 then
- forward = true
- walkAnimation(forward)
- elseif playerVelocity.x < -1 then
- forward = false
- walkAnimation(forward)
- elseif forward then
- player.Image = "http://www.roblox.com/asset/?id=" .. playerWalkForward[1]
- walkCounter = 1
- else
- player.Image = "http://www.roblox.com/asset/?id=" .. playerWalkBackward[1]
- walkCounter = 1
- end
- end
- local left = true
- function spawnEnemy()
- local enemy = Instance.new("ImageLabel")
- enemy.Image = "http://www.roblox.com/asset/?id=32183056"
- enemy.Size = UDim2.new(0,16,0,16)
- enemy.BackgroundTransparency = 1
- enemy.BorderSizePixel = 0
- enemy.ZIndex = 2
- if left then
- enemy.Position = UDim2.new(0,0,0,0)
- else
- enemy.Position = UDim2.new(0,380,0,0)
- end
- enemy.Name = "Enemy"
- enemy.Parent = gui.Cabinet.Screen.Enemies
- local leftDirection = Instance.new("BoolValue")
- leftDirection.Name = "Left"
- leftDirection.Value = not left
- leftDirection.Parent = enemy
- left = not left
- end
- local spawned = false
- local maxEnemies = 0
- function updateEnemies()
- maxEnemies = 4 + (time/900)
- local enemies = gui.Cabinet.Screen.Enemies:GetChildren()
- if #enemies < maxEnemies and not spawned then
- spawned = true
- spawnEnemy()
- local co = coroutine.create(function()
- wait(math.random(1,3))
- spawned = false
- end)
- coroutine.resume(co)
- end
- for i = 1, #enemies do
- if enemies[i].Left.Value then
- enemies[i].Position = UDim2.new(0,enemies[i].Position.X.Offset - 3,0,enemies[i].Position.Y.Offset)
- else
- enemies[i].Position = UDim2.new(0,enemies[i].Position.X.Offset + 3,0,enemies[i].Position.Y.Offset)
- end
- end
- end
- function updatePrize()
- if prizeRegenTimer > 0 then
- prizeRegenTimer = prizeRegenTimer - 1
- return
- end
- if prize == nil then
- prize = Instance.new("ImageLabel")
- prize.Name = "Prize"
- prize.Size = UDim2.new(0,24,0,24)
- prize.Image = "http://www.roblox.com/asset/?id=32190862"
- prize.BackgroundTransparency = 1
- prize.BorderSizePixel = 0
- prize.Parent = gui.Cabinet.Screen
- local pos = math.random(1,4)
- if pos == 1 then prize.Position = UDim2.new(0,24,0,120)
- elseif pos == 2 then prize.Position = UDim2.new(0,350,0,120)
- elseif pos == 3 then prize.Position = UDim2.new(0,350,0,230)
- else prize.Position = UDim2.new(0,24,0,230) end
- end
- end
- function gameOver()
- Tool.Handle.Song:Stop()
- Tool.Handle.Fail:Play()
- wait(1)
- if gui:FindFirstChild("Cabinet") then
- gui.Cabinet:remove()
- end
- local scoreFrame = gui:FindFirstChild("ScoreFrame")
- if scoreFrame then
- scoreFrame.BackgroundTransparency = 0.2
- end
- while scoreFrame do
- gui.ScoreFrame.Position = UDim2.new(0.5,gui.ScoreFrame.Position.X.Offset,0.5,gui.ScoreFrame.Position.Y.Offset - 3)
- if gui.ScoreFrame.Position.Y.Offset <= 0 then wait(3) return end
- wait()
- end
- end
- function gameLoop()
- animTimer = 0
- gaming = true
- while gaming do
- Physics()
- Collision()
- Controls()
- updatePlayerPos()
- updateEnemies()
- updatePrize()
- time = time + 0.05
- animTimer = animTimer + 1
- if animTimer == 3 then
- animation()
- animTimer = 0
- end
- gui.ScoreFrame.Score.Text = tostring(math.floor(time))
- wait(0.03)
- end
- if head.Anchored then
- gameOver()
- end
- end
- end))
- ScreenGui58.Name = "GameGui"
- ScreenGui58.Parent = Tool56
- Part59.Parent = Model0
- Part59.Material = Enum.Material.DiamondPlate
- Part59.BrickColor = BrickColor.new("Light stone grey")
- Part59.Rotation = Vector3.new(165, 0, -90)
- Part59.Anchored = true
- Part59.FormFactor = Enum.FormFactor.Custom
- Part59.Size = Vector3.new(6.00000095, 0.200000003, 0.999999821)
- 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)
- Part59.TopSurface = Enum.SurfaceType.Smooth
- Part59.Color = Color3.new(0.898039, 0.894118, 0.87451)
- Part59.Position = Vector3.new(50.0999985, 6.54193306, 61.2999954)
- Part59.Orientation = Vector3.new(15, -180, 90)
- Part59.Color = Color3.new(0.898039, 0.894118, 0.87451)
- Part60.Parent = Model0
- Part60.Material = Enum.Material.DiamondPlate
- Part60.BrickColor = BrickColor.new("Light stone grey")
- Part60.Rotation = Vector3.new(-15, 0, 0)
- Part60.Anchored = true
- Part60.FormFactor = Enum.FormFactor.Custom
- Part60.Size = Vector3.new(7.19999981, 0.200000003, 0.999999821)
- Part60.CFrame = CFrame.new(46.5999985, 9.53627205, 60.4976654, 1, 0, 0, 0, 0.965925813, 0.258819044, 0, -0.258819044, 0.965925813)
- Part60.TopSurface = Enum.SurfaceType.Smooth
- Part60.Color = Color3.new(0.898039, 0.894118, 0.87451)
- Part60.Position = Vector3.new(46.5999985, 9.53627205, 60.4976654)
- Part60.Orientation = Vector3.new(-15, 0, 0)
- Part60.Color = Color3.new(0.898039, 0.894118, 0.87451)
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = workspace
- pcall(function() v:MakeJoints() end)
- end
- mas:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement