Advertisement
CloneTrooper1019

Deejay

Jun 20th, 2014
450
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 9.18 KB | None | 0 0
  1. DJ = "Player1"
  2.  
  3. playlist = {
  4.     {
  5.         Asset = 157705295;
  6.         Length = 111;
  7.     },
  8.     {
  9.         Asset = 142468746;
  10.         Length = 120;
  11.     },
  12.     {
  13.         Asset = 162261155;
  14.         Length = 74;
  15.     },
  16.     {
  17.         Asset = 162258269;
  18.         Length = 118;
  19.     },
  20.     {
  21.         Asset = 142402325;
  22.         Length = 214.5;
  23.         Pitch = 0.575;
  24.     }
  25. }
  26.  
  27. function stopAllSound(obj)
  28.     local function recurse(o)
  29.         for _,v in pairs(o:GetChildren()) do
  30.             if v:IsA("Sound") then
  31.                 v:Stop()
  32.                 v:Destroy()
  33.             else
  34.                 recurse(v)
  35.             end
  36.         end
  37.     end
  38.     recurse(obj)
  39. end
  40.  
  41. function Create(ty)
  42.     return function(data)
  43.         local obj = Instance.new(ty)
  44.         for k, v in pairs(data) do
  45.             if type(k) == 'number' then
  46.                 v.Parent = obj
  47.             else
  48.                 obj[k] = v
  49.             end
  50.         end
  51.         return obj
  52.     end
  53. end
  54.  
  55. stopAllSound(workspace)
  56.  
  57. priority = "Random";
  58. state = 3;
  59. localState = 3;
  60. up = 1
  61. down = 0.25
  62.  
  63. states = {"Static-On","Strobe","Off"};
  64.  
  65. Colors = {
  66.     Red = Vector3.new(1,0,0);
  67.     Green = Vector3.new(0,1,0);
  68.     Blue = Vector3.new(0,0,1);
  69.     White = Vector3.new(1,1,1);
  70. }
  71.  
  72. player = game.Players:findFirstChild(DJ)
  73. if not player then
  74.     error("UNABLE TO FIND DJ. SESSION ABORTED")
  75. end
  76.  
  77. if not player:findFirstChild("PlayerGui") then
  78.     error("UNABLE TO FIND DJ's PLAYERGUI. ABORTED")
  79. end
  80.  
  81. gui = Create'ScreenGui'{
  82.     Parent = player.PlayerGui;
  83.     Create'Frame'{
  84.         Size = UDim2.new(0.2, 0, 0, 470);
  85.         Draggable = true;
  86.         Style = Enum.FrameStyle.RobloxRound;
  87.         Position = UDim2.new(0.775, 0, 0.15, 0);
  88.         BackgroundColor3 = Color3.new(1, 1, 1);
  89.         Create'StringValue'{
  90.             Name = "LightingPriority";
  91.             Value = "Random";
  92.         };
  93.         Create'IntValue'{
  94.             Name = "UpFlashRate";
  95.         };
  96.         Create'IntValue'{
  97.             Name = "DownFlashRate";
  98.         };
  99.         Create'TextLabel'{
  100.             FontSize = Enum.FontSize.Size24;
  101.             Text = "DJ Lighting Thing";
  102.             Size = UDim2.new(1, 0, 0.15, 0);
  103.             Draggable = true;
  104.             TextColor3 = Color3.new(1, 1, 1);
  105.             Font = Enum.Font.SourceSansBold;
  106.             Name = "Title";
  107.             BackgroundTransparency = 1;
  108.             BackgroundColor3 = Color3.new(1, 1, 1);
  109.         };
  110.         Create'Frame'{
  111.             Size = UDim2.new(1, 0, 1, 0);
  112.             Name = "LightingSet";
  113.             Position = UDim2.new(0.225, 0, 0, 0);
  114.             BackgroundTransparency = 1;
  115.             BackgroundColor3 = Color3.new(1, 1, 1);
  116.             Create'TextButton'{
  117.                 FontSize = Enum.FontSize.Size14;
  118.                 BackgroundColor3 = Color3.new(0.278431, 0.278431, 0.278431);
  119.                 Name = "Red";
  120.                 Text = "Lighting Priority Red";
  121.                 Size = UDim2.new(0.5, 0, 0, 30);
  122.                 TextColor3 = Color3.new(1, 0, 0);
  123.                 Font = Enum.Font.SourceSans;
  124.                 Position = UDim2.new(0, 0, 0.175, 0);
  125.             };
  126.             Create'TextButton'{
  127.                 FontSize = Enum.FontSize.Size14;
  128.                 BackgroundColor3 = Color3.new(0.278431, 0.278431, 0.278431);
  129.                 Name = "Green";
  130.                 Text = "Lighting Priority Green";
  131.                 Size = UDim2.new(0.5, 0, 0, 30);
  132.                 TextColor3 = Color3.new(0, 1, 0);
  133.                 Font = Enum.Font.SourceSans;
  134.                 Position = UDim2.new(0, 0, 0.175, 40);
  135.             };
  136.             Create'TextButton'{
  137.                 FontSize = Enum.FontSize.Size14;
  138.                 BackgroundColor3 = Color3.new(0.278431, 0.278431, 0.278431);
  139.                 Name = "Blue";
  140.                 Text = "Lighting Priority Blue";
  141.                 Size = UDim2.new(0.5, 0, 0, 30);
  142.                 TextColor3 = Color3.new(0, 0, 1);
  143.                 Font = Enum.Font.SourceSans;
  144.                 Position = UDim2.new(0, 0, 0.175, 80);
  145.             };
  146.             Create'TextButton'{
  147.                 FontSize = Enum.FontSize.Size14;
  148.                 BackgroundColor3 = Color3.new(0.278431, 0.278431, 0.278431);
  149.                 Name = "White";
  150.                 Text = "Lighting Priority White";
  151.                 Size = UDim2.new(0.5, 0, 0, 30);
  152.                 TextColor3 = Color3.new(1, 1, 1);
  153.                 Font = Enum.Font.SourceSans;
  154.                 Position = UDim2.new(0, 0, 0.175, 120);
  155.             };
  156.             Create'TextButton'{
  157.                 FontSize = Enum.FontSize.Size14;
  158.                 BackgroundColor3 = Color3.new(0.278431, 0.278431, 0.278431);
  159.                 Name = "Random";
  160.                 Text = "Random Lighting";
  161.                 Size = UDim2.new(0.5, 0, 0, 30);
  162.                 TextColor3 = Color3.new(1, 1, 0);
  163.                 Font = Enum.Font.SourceSans;
  164.                 Position = UDim2.new(0, 0, 0.175, 160);
  165.             };
  166.         };
  167.         Create'TextButton'{
  168.             FontSize = Enum.FontSize.Size14;
  169.             Modal = true;
  170.             BackgroundColor3 = Color3.new(0.278431, 0.278431, 0.278431);
  171.             Name = "StrobeToggle";
  172.             Text = "Lighting: Off";
  173.             Size = UDim2.new(0.5, 0, 0, 30);
  174.             TextColor3 = Color3.new(1, 1, 1);
  175.             Font = Enum.Font.SourceSansBold;
  176.             Position = UDim2.new(0.225, 0, 0.175, 210);
  177.         };
  178.         Create'TextBox'{
  179.             FontSize = Enum.FontSize.Size14;
  180.             Text = "0.25";
  181.             Size = UDim2.new(0.4, 0, 0, 30);
  182.             TextColor3 = Color3.new(1, 1, 1);
  183.             Font = Enum.Font.SourceSans;
  184.             Name = "DownRate";
  185.             Position = UDim2.new(0.05, 0, 0.75, 0);
  186.             BackgroundColor3 = Color3.new(0.278431, 0.278431, 0.278431);
  187.             Create'TextLabel'{
  188.                 FontSize = Enum.FontSize.Size14;
  189.                 Text = "Flash Down Time";
  190.                 Size = UDim2.new(1, 0, 0.5, 0);
  191.                 TextColor3 = Color3.new(1, 1, 1);
  192.                 Font = Enum.Font.SourceSans;
  193.                 Position = UDim2.new(0, 0, -0.6, 0);
  194.                 BackgroundTransparency = 1;
  195.                 BackgroundColor3 = Color3.new(1, 1, 1);
  196.             };
  197.         };
  198.         Create'TextBox'{
  199.             FontSize = Enum.FontSize.Size14;
  200.             Text = "1";
  201.             Size = UDim2.new(0.4, 0, 0, 30);
  202.             TextColor3 = Color3.new(1, 1, 1);
  203.             MultiLine = true;
  204.             Font = Enum.Font.SourceSans;
  205.             Name = "UpRate";
  206.             Position = UDim2.new(0.55, 0, 0.75, 0);
  207.             BackgroundColor3 = Color3.new(0.278431, 0.278431, 0.278431);
  208.             Create'TextLabel'{
  209.                 FontSize = Enum.FontSize.Size14;
  210.                 Text = "Flash Up Time";
  211.                 Size = UDim2.new(1, 0, 0.5, 0);
  212.                 TextColor3 = Color3.new(1, 1, 1);
  213.                 Font = Enum.Font.SourceSans;
  214.                 Position = UDim2.new(0, 0, -0.6, 0);
  215.                 BackgroundTransparency = 1;
  216.                 BackgroundColor3 = Color3.new(1, 1, 1);
  217.             };
  218.         };
  219.         Create'TextButton'{
  220.             FontSize = Enum.FontSize.Size14;
  221.             Modal = true;
  222.             BackgroundColor3 = Color3.new(0.278431, 0.278431, 0.278431);
  223.             Name = "Push";
  224.             Text = "START PLAYLIST";
  225.             Size = UDim2.new(0.75, 0, 0, 30);
  226.             TextColor3 = Color3.new(1, 1, 1);
  227.             Font = Enum.Font.SourceSansBold;
  228.             Position = UDim2.new(0.125, 0, 0.875, 0);
  229.         };
  230.         Create'StringValue'{
  231.             Name = "State";
  232.             Value = "Static";
  233.         };
  234.     };
  235. }
  236.  
  237. gui.Frame.DownRate.FocusLost:connect(function ()
  238.     if not tonumber(gui.Frame.DownRate.Text) then
  239.         gui.Frame.DownRate.Text = down
  240.     end
  241. end)
  242.  
  243. gui.Frame.UpRate.FocusLost:connect(function ()
  244.     if not tonumber(gui.Frame.UpRate.Text) then
  245.         gui.Frame.UpRate.Text = up
  246.     end
  247. end)
  248.  
  249. gui.Frame.StrobeToggle.MouseButton1Down:connect(function ()
  250.     localState = (localState == 3) and 1 or localState + 1
  251.     gui.Frame.StrobeToggle.Text = "Lighting: "..states[localState]
  252. end)
  253.  
  254. gui.Frame.Push.MouseButton1Down:connect(function ()
  255.     gui.Frame.Push.Text = "UPDATE W/ CURRENT VALUES"
  256.     start = true
  257.     priority = gui.Frame.LightingPriority.Value
  258.     state = localState
  259.     up = gui.Frame.UpFlashRate.Value
  260.     down = gui.Frame.DownFlashRate.Value
  261. end)
  262.  
  263. for _,v in pairs(gui.Frame.LightingSet:GetChildren()) do
  264.     v.MouseButton1Down:connect(function ()
  265.         gui.Frame.LightingPriority.Value = v.Name
  266.         for _,a in pairs(gui.Frame.LightingSet:GetChildren()) do
  267.             local c = 0.27450980392157 * (gui.Frame.LightingPriority.Value == a.Name and 2 or 1)
  268.             a.BackgroundColor3 = Color3.new(c,c,c)
  269.         end
  270.     end)
  271. end
  272.  
  273. lastUp = 0
  274. lastDown = 0
  275. currentDir = "Down"
  276. song = 0
  277. lastSong = 0
  278. lastSound = nil
  279. currentSound = nil
  280. start = false
  281.  
  282. lUpdate = 0
  283.  
  284. h = Instance.new("Hint",workspace)
  285.  
  286. local function stopAudio(o)
  287.     for _,v in pairs(o:GetChildren()) do
  288.         if v:IsA("Sound") then
  289.             v:Stop()
  290.             v.Volume = 0
  291.             v:Destroy()
  292.         else
  293.             stopAudio(v)
  294.         end
  295.     end
  296. end
  297.  
  298. stopAudio(workspace)
  299.  
  300. audio = Instance.new("Sound",workspace)
  301. audio.Name = "Main";
  302.  
  303. while wait() do
  304.     if tick()-lUpdate > .1 then
  305.         lUpdate = tick()
  306.         local n
  307.         if state == 1 then
  308.             n = priority == "Random" and Vector3.new(.7,.7,.7) or Colors[priority]
  309.         elseif state == 2 then
  310.             n = priority == "Random" and Vector3.new(math.random(),math.random(),math.random()) or Colors[priority]*math.random()
  311.         elseif state == 3 then
  312.             n = Vector3.new()
  313.         end
  314.         if tick()-lastDown >= down and down ~= 0 then
  315.             lastUp = tick()
  316.             lastDown = math.huge
  317.             currentDir = "Up"
  318.         elseif tick()-lastUp >= up and up ~= 0 then
  319.             lastDown = tick()
  320.             lastUp = math.huge
  321.             currentDir = "Down"
  322.         end
  323.         n = currentDir == "Down" and not state == 3 and Vector3.new() or n
  324.         local o = n*.75
  325.         game.Lighting.OutdoorAmbient = Color3.new(n.X,n.Y,n.Z)
  326.         game.Lighting.Ambient = Color3.new(o.X,o.Y,o.Z)
  327.     end
  328.     if start and (song == 0 or tick()-lastSong > playlist[song].Length) then
  329.         song = song + 1
  330.         audio:Stop()
  331.         local nextSong = playlist[song]
  332.         if nextSong then
  333.             local assetID = playlist[song].Asset
  334.             local songName = game:GetService("MarketplaceService"):GetProductInfo(assetID).Name
  335.             h.Text = "Now Playing: '"..songName.."'"
  336.             lastSong = tick()
  337.             audio.SoundId = "rbxassetid://"..assetID
  338.             audio.Pitch = playlist[song].Pitch or 1
  339.             audio:Play()
  340.         else
  341.             local m = Instance.new("Message",workspace)
  342.             m.Text = "Unfortunately, thats all we have time for today :("
  343.             wait(2)
  344.             m.Text = "This DJing session actually destroyed the script causing the previous audio to loop..."
  345.             wait(2)
  346.             m.Text = "So this server is unfortunately useless now. Have a nice day :D!"
  347.             wait(1)
  348.             for _,v in pairs(game.Players:GetPlayers()) do
  349.                 v:Kick()
  350.             end
  351.             Instance.new("ManualSurfaceJointInstance",workspace)
  352.         end
  353.     end
  354. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement