Advertisement
KrYn0MoRe

dvd screensaver

Aug 25th, 2018 (edited)
402
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.94 KB | None | 0 0
  1. local Part0 = Instance.new("Part")
  2. local SurfaceGui1 = Instance.new("SurfaceGui")
  3. local TextLabel2 = Instance.new("TextLabel")
  4. Part0.Name = "Score"
  5. Part0.Parent = script
  6. Part0.CFrame = CFrame.new(0, 0, 91.226, 0, 0, -1, -1, 0, 0, 0, 1, 0)
  7. Part0.Orientation = Vector3.new(0, -90, -90)
  8. Part0.Position = Vector3.new(0, 0, 91.226)
  9. Part0.Rotation = Vector3.new(90, -90, 0)
  10. Part0.Transparency = 2
  11. Part0.Size = Vector3.new(1.68533111, 16.1999741, 96.569458)
  12. Part0.Anchored = true
  13. Part0.BackSurface = Enum.SurfaceType.SmoothNoOutlines
  14. Part0.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
  15. Part0.CanCollide = false
  16. Part0.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
  17. Part0.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
  18. Part0.RightSurface = Enum.SurfaceType.SmoothNoOutlines
  19. Part0.TopSurface = Enum.SurfaceType.SmoothNoOutlines
  20. Part0.FormFactor = Enum.FormFactor.Custom
  21. Part0.formFactor = Enum.FormFactor.Custom
  22. SurfaceGui1.Parent = Part0
  23. SurfaceGui1.Face = Enum.NormalId.Left
  24. SurfaceGui1.CanvasSize = Vector2.new(400, 60)
  25. TextLabel2.Parent = SurfaceGui1
  26. TextLabel2.Size = UDim2.new(1, 0, 1, 0)
  27. TextLabel2.BackgroundColor = BrickColor.new("Institutional white")
  28. TextLabel2.BackgroundColor3 = Color3.new(1, 1, 1)
  29. TextLabel2.BackgroundTransparency = 1
  30. TextLabel2.BorderSizePixel = 0
  31. TextLabel2.Font = Enum.Font.SourceSansBold
  32. TextLabel2.FontSize = Enum.FontSize.Size36
  33. TextLabel2.Text = ""  --"Corner Hits : 0"
  34. TextLabel2.TextColor = BrickColor.new("Institutional white")
  35. TextLabel2.TextColor3 = Color3.new(1, 1, 1)
  36. TextLabel2.TextScaled = true
  37. TextLabel2.TextSize = 36
  38. TextLabel2.TextStrokeTransparency = 0
  39. TextLabel2.TextWrap = true
  40. TextLabel2.TextWrapped = true
  41. amount = 1
  42.  
  43. local X = 1
  44. local Z = 1
  45. local speed = 1
  46. local hits = 0
  47. if math.random(1,2) == 1 then
  48.     X = -1
  49. end
  50. if math.random(1,2) == 1 then
  51.     Z = -1
  52. end
  53. local A = Instance.new("Part",script)
  54. A.Anchored = true
  55. A.Size = Vector3.new(320,1,200) --(350,1,220)
  56. A.BrickColor = BrickColor.new("Really black")
  57. A.Material = Enum.Material.Neon
  58. local P = Instance.new("Part",script)
  59. P.Anchored = true
  60. P.Size = Vector3.new(40,1,20)
  61. P.Position = Vector3.new(math.random(-135,135),0.25,math.random(-80,80))
  62. P.Transparency = 1
  63. local D = Instance.new("Decal",P)
  64. D.Face = Enum.NormalId.Top
  65. D.Texture = "rbxassetid://2642637131"
  66. local Last = 1
  67. function Change()
  68.     local Choice = math.random(1,4)
  69.     local No = false
  70.     if Choice == Last then
  71.         No = true
  72.     end
  73.     if Choice == 1 then
  74.         P.BrickColor = BrickColor.new("Really red")
  75.         Last = 1
  76.     elseif Choice == 2 then
  77.         P.BrickColor = BrickColor.new("Really blue")
  78.         Last = 2
  79.     elseif Choice == 3 then
  80.         P.BrickColor = BrickColor.new("Lime green")
  81.         Last = 3
  82.     else
  83.         P.BrickColor = BrickColor.new("White")
  84.         Last = 4
  85.     end
  86.     if No then
  87.         Change()
  88.     end
  89.     D.Color3 = P.Color
  90. end
  91. spawn(function()
  92. while true do
  93.     wait()
  94.     P.Position = P.Position + Vector3.new(X * speed,0,Z * speed)
  95.     local x = false
  96.     local z = false
  97.     if P.Position.X > A.Size.X/2-P.Size.X/2 then
  98.         X = -1
  99.         x = true
  100.         local thump = Instance.new("Sound",script)
  101.         thump.Volume = 1
  102.         thump.SoundId = "rbxassetid://181308673"
  103.         thump.Looped = false
  104.         thump:Play()
  105.         Change()
  106.     elseif P.Position.X < -(A.Size.X/2-P.Size.X/2) then
  107.         X = 1
  108.         x = true
  109.         local thump = Instance.new("Sound",script)
  110.         thump.Volume = 1
  111.         thump.SoundId = "rbxassetid://181308673"
  112.         thump.Looped = false
  113.         thump:Play()
  114.         Change()
  115.     end
  116.     if P.Position.Z > A.Size.Z/2-P.Size.Z/2 then
  117.         Z = -1
  118.         z = true
  119.         local thump = Instance.new("Sound",script)
  120.         thump.Volume = 1
  121.         thump.SoundId = "rbxassetid://181308673"
  122.         thump.Looped = false
  123.         thump:Play()
  124.         Change()
  125.     elseif P.Position.Z < -(A.Size.Z/2-P.Size.Z/2) then
  126.         Z = 1
  127.         z = true
  128.         local thump = Instance.new("Sound",script)
  129.         thump.Volume = 1
  130.         thump.SoundId = "rbxassetid://181308673"
  131.         thump.Looped = false
  132.         thump:Play()
  133.         Change()
  134.     end
  135.     if x and z then
  136.         delay(0,function()
  137.         spawn(function()
  138.         --hits = hits + 1
  139.         TextLabel2.TextTransparency = 0
  140.         TextLabel2.Text = "Corner Has Been Hit!" --"Corner Hits : " ..hits
  141.         local corner = Instance.new("Sound",script)
  142.         corner.Volume = 10
  143.         corner.SoundId = "rbxassetid://516103418"
  144.         corner.Looped = false
  145.         corner:Play()
  146.             spawn(function()
  147.             for i = 1,720 do
  148.                 wait()
  149.                 TextLabel2.TextColor3 = Color3.new(math.random(0.00,1.00),math.random(0.00,1.00),math.random(0.00,1.00))
  150.             end
  151.             end)
  152.             local TweenService = game:GetService("TweenService")
  153.             local Info = TweenInfo.new(4,Enum.EasingStyle.Linear)
  154.             wait(8)
  155.             local tween = TweenService:Create(TextLabel2,Info,{TextTransparency = 1})
  156.             tween:Play()
  157.             --A.BrickColor = BrickColor.new("Really black")
  158.         end)
  159.         end)
  160.     end
  161. end
  162. end)
  163.  
  164. function deploy(spawns)
  165. for i = 1,spawns do
  166. local X = 1
  167. local Z = 1
  168. local hits = 0
  169. if math.random(1,2) == 1 then
  170.     X = -1
  171. end
  172. if math.random(1,2) == 1 then
  173.     Z = -1
  174. end
  175. local A = Instance.new("Part",script)
  176. A.Anchored = true
  177. A.Size = Vector3.new(320,1,200) --(350,1,220)
  178. A.BrickColor = BrickColor.new("Really black")
  179. A.Material = Enum.Material.Neon
  180. local P = Instance.new("Part",script)
  181. P.Anchored = true
  182. P.Size = Vector3.new(40,1,20)
  183. P.Position = Vector3.new(math.random(-135,135),0.25,math.random(-80,80))
  184. P.Transparency = 1
  185. local D = Instance.new("Decal",P)
  186. D.Face = Enum.NormalId.Top
  187. D.Texture = "rbxassetid://2642637131"
  188. local Last = 1
  189. local function change2()
  190.     local Choice = math.random(1,4)
  191.     local No = false
  192.     if Choice == Last then
  193.         No = true
  194.     end
  195.     if Choice == 1 then
  196.         P.BrickColor = BrickColor.new("Really red")
  197.         Last = 1
  198.     elseif Choice == 2 then
  199.         P.BrickColor = BrickColor.new("Really blue")
  200.         Last = 2
  201.     elseif Choice == 3 then
  202.         P.BrickColor = BrickColor.new("Lime green")
  203.         Last = 3
  204.     else
  205.         P.BrickColor = BrickColor.new("White")
  206.         Last = 4
  207.     end
  208.     if No then
  209.         change2()
  210.     end
  211.     D.Color3 = P.Color
  212. end
  213. spawn(function()
  214. while true do
  215.     wait()
  216.     P.Position = P.Position + Vector3.new(X * speed,0,Z * speed)
  217.     local x = false
  218.     local z = false
  219.     if P.Position.X > A.Size.X/2-P.Size.X/2 then
  220.         X = -1
  221.         x = true
  222.         local thump = Instance.new("Sound",script)
  223.         thump.Volume = 1
  224.         thump.SoundId = "rbxassetid://181308673"
  225.         thump.Looped = false
  226.         thump:Play()
  227.         change2()
  228.     elseif P.Position.X < -(A.Size.X/2-P.Size.X/2) then
  229.         X = 1
  230.         x = true
  231.         local thump = Instance.new("Sound",script)
  232.         thump.Volume = 1
  233.         thump.SoundId = "rbxassetid://181308673"
  234.         thump.Looped = false
  235.         thump:Play()
  236.         change2()
  237.     end
  238.     if P.Position.Z > A.Size.Z/2-P.Size.Z/2 then
  239.         Z = -1
  240.         z = true
  241.         local thump = Instance.new("Sound",script)
  242.         thump.Volume = 1
  243.         thump.SoundId = "rbxassetid://181308673"
  244.         thump.Looped = false
  245.         thump:Play()
  246.         change2()
  247.     elseif P.Position.Z < -(A.Size.Z/2-P.Size.Z/2) then
  248.         Z = 1
  249.         z = true
  250.         local thump = Instance.new("Sound",script)
  251.         thump.Volume = 1
  252.         thump.SoundId = "rbxassetid://181308673"
  253.         thump.Looped = false
  254.         thump:Play()
  255.         change2()
  256.     end
  257.     if x and z then
  258.         delay(0,function()
  259.         spawn(function()
  260.         --hits = hits + 1
  261.         TextLabel2.TextTransparency = 0
  262.         TextLabel2.Text = "Corner Has Been Hit!" --"Corner Hits : " ..hits
  263.         local corner = Instance.new("Sound",script)
  264.         corner.Volume = 10
  265.         corner.SoundId = "rbxassetid://516103418"
  266.         corner.Looped = false
  267.         corner:Play()
  268.             spawn(function()
  269.             for i = 1,720 do
  270.                 wait()
  271.                 TextLabel2.TextColor3 = Color3.new(math.random(0.00,1.00),math.random(0.00,1.00),math.random(0.00,1.00))
  272.             end
  273.             end)
  274.             local TweenService = game:GetService("TweenService")
  275.             local Info = TweenInfo.new(4,Enum.EasingStyle.Linear)
  276.             wait(8)
  277.             local tween = TweenService:Create(TextLabel2,Info,{TextTransparency = 1})
  278.             tween:Play()
  279.             --A.BrickColor = BrickColor.new("Really black")
  280.         end)
  281.         end)
  282.     end
  283. end
  284. end)
  285. end
  286. end
  287.  
  288. plr = owner
  289. plr.Chatted:Connect(function(msg)
  290. if msg:lower():sub(1,4) == "dvd/" then
  291. local choice = msg:sub(5)
  292. if tonumber(choice) then
  293. deploy(tonumber(choice))
  294. amount = amount + tonumber(choice)
  295. end
  296. end
  297. if msg:lower():sub(1,6) == "total/" then
  298. warn(amount .." DvDs are spawned.")
  299. end
  300. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement