Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 14th, 2012  |  syntax: None  |  size: 10.66 KB  |  hits: 20  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. assert(workspace:FindFirstChild("Generator")~=nil,"There is no Generator model!")
  2. --Instructors are in marks throughout the script
  3. trainers = {"dudiebum10","Lordofsmartness","jasontor1000","Maculus","YaYaBinks3"}
  4. gs = {} -- If you have a script in your environment, put the name in here
  5.  
  6. --[[For the Generator:
  7.                 - Have a Model in the workspace named Generator
  8.                 - In this, have a brick named Torso
  9.                 - Also have a humanoid
  10.                 - Run this in the Command Bar: (After completing the first 3 bulletpoints)
  11.                         select = Instance.new("SelectionPartLasso",workspace.Generator) select.Name = "Connection" select.Humanoid = select.Parent.Humanoid
  12.         ]]
  13.  
  14. function globalScript(s)
  15. yes = false
  16.         for i = 1,#gs do
  17.                 if s.Name == gs[i] then
  18.                 yes = true
  19.                 break
  20.                 end
  21.         end
  22. return yes
  23. end
  24.  
  25. game.Players.PlayerAdded:connect(function(player)
  26.         for i=1,#trainers do
  27.                 if trainers[i]==player.Name then
  28.                 player.Chatted:connect(onDoorSpeak)
  29.                 break
  30.                 end
  31.         end
  32. end)
  33.  
  34. function checkEnv()
  35. yes = false
  36.         for _,v in pairs(workspace:GetChildren()) do
  37.                 if v:FindFirstChild("Environment") then
  38.                 yes = true
  39.                 end
  40.         end
  41. return yes
  42. end
  43.  
  44. envtools = {
  45.         ["nil"]         = {}; -- Keep this. It is required for the command to work properly
  46.    ["winter"]   = {"Rifle"};
  47.    ["arena"]   = {"Rifle", "Sniper"};
  48.         ["cs"]          = {};
  49.         ["combat"]      = {"Rifle","Sword"};
  50.         ["boss"]        = {"Rifle"};
  51.    ["cave"]     = {"Sword"};
  52.    ["water fight"]      = {"Sword","Rifle","Sniper"};
  53.    ["bunker"]   = {"Sniper"};
  54.    ["bunker"]   = {"Sniper"};
  55.    ["tower"]    = {"Sword", "Rifle"};
  56.         ["test"]                = {"Sword"};
  57.  
  58. }
  59.  
  60. tloc = {"Backpack","StarterGear"}
  61.  
  62. function resetTools(Player)
  63.         for _,btool in pairs(Player.Backpack:GetChildren()) do
  64.         btool:Remove()
  65.         end
  66.         for _,stool in pairs(Player.StarterGear:GetChildren()) do
  67.         stool:Remove()
  68.         end
  69. end
  70.  
  71. function loadTools(Program)
  72.         for _,v in pairs(game.Players:GetPlayers()) do
  73.                 resetTools(v)
  74.                 for key,val in pairs(envtools) do
  75.                         if string.lower(key) == string.lower(Program) then
  76.                                 for _,tool in pairs(val) do
  77.                                         if game.Lighting:FindFirstChild(tool) then
  78.                                         local t = game.Lighting:FindFirstChild(tool)
  79.                                                 for i = 1,#tloc do
  80.                                                 t:Clone().Parent = v[tloc[i]]
  81.                                                 wait()
  82.                                                 end
  83.                                         end
  84.                                 end
  85.                         end
  86.                 end
  87.         end
  88. end
  89.  
  90. -----------
  91.  
  92. function Select(Brick,Color)
  93. s = Instance.new("SelectionBox",Brick)
  94. s.Color = BrickColor.new(Color)
  95. s.Adornee = Brick
  96. workspace.Generator.Connection.Part = Brick
  97. workspace.Generator.Connection.Color = BrickColor.new(Color)
  98. end
  99.  
  100. function Deselect(Brick)
  101.         if Brick:FindFirstChild("SelectionBox") then
  102.         Brick.SelectionBox:Remove()
  103.         end
  104. workspace.Generator.Connection.Part = nil
  105. end
  106.  
  107. function Program(Environment,Off)
  108.         if not Off then
  109.         newEnv = Instance.new("Model",workspace) -- Why create a new model instead of copying it?
  110.         newEnv.Name = Environment.Name -- Copying individual bricks causes less lag than copying a bunch at one time
  111.         envTag = Instance.new("NumberValue",newEnv) -- Plus this allows us to have the bricks interrupting other models
  112.         envTag.Name = "Environment"
  113.                 for _,v in pairs(Environment:GetChildren()) do
  114.                         if v:IsA("BasePart") then
  115.                         cframe = v.CFrame -- Our part's position (As a CFrame :3)
  116.                         newP = v:Clone()
  117.                         newP.Parent = newEnv
  118.                         newP.CFrame = cframe
  119.                         Select(newP,"Bright blue")
  120.                         wait()
  121.                                 if newP:FindFirstChild("Transparent") then -- Some bricks need custom transparency (Default is 0)
  122.                                 newP.Transparency = newP:FindFirstChild("Transparent").Value
  123.                                 else
  124.                                 newP.Transparency = 0 -- Default transparency (0)
  125.                                 end
  126.                         Deselect(newP)
  127.                         elseif v:IsA("Script") then
  128.                                 if globalScript(v) then
  129.                                 newS = v:Clone()
  130.                                 newS.Parent = newEnv
  131.                                 end
  132.                         end
  133.                 end
  134.         m = Instance.new("Message",workspace)
  135.         m.Text = "Creation of "..string.upper(Environment.Name).." Is finished please enter when ready." -- Edit this to whatever you want, or remove it
  136.         wait(5)
  137.         m:Remove()
  138.         elseif Off then
  139.                 for _,v in pairs(Environment:GetChildren()) do
  140.                         if v:IsA("BasePart") then
  141.                         Select(v,"Bright red")
  142.                         wait()
  143.                         v:Remove()
  144.                         end
  145.                 end
  146.         wait(0.1)
  147.         Environment:Remove()
  148.         end
  149. end
  150.        
  151.  
  152. function onDoorSpeak(msg,recip) -- The main speaking function (Originally this was intended only for doors; hence "onDoorSpeak")
  153.  
  154. keywords = { -- Table filled with keywords
  155.         sample = {"Test", "computer","begin","end","courtney starling","program","combat","winter fight","arena","boss fight","armoury","cave","water fight","bunker","meeting","tower"};
  156. }
  157.  
  158. keyvals = { -- Values to tell us if we said them or not
  159.         ["computer"]                            = false; -- The key of these variables must be the same as the corresponding value of keywords
  160.         ["begin"]                                       = false;
  161.         ["end"]                                         = false;
  162.         ["courtney starling"]   = false;
  163.         ["program"]                                     = false;
  164.         ["combat"]                                      = false;
  165.         ["winter fight"]                        = false;
  166.    ["arena"]                          = false;
  167.    ["boss fight"]                       = false;
  168.    ["armoury"]                          = false;
  169.    ["cave"]                                     = false;
  170.    ["water fight"]                      = false;
  171.    ["bunker"]                                   = false;
  172.    ["meeting"]                          = false;
  173.    ["tower"]                                    = false;
  174.         ["test"]                                                = false;
  175. }
  176.  
  177.         for _,v in pairs(keywords) do -- This little bit here tells us what was said
  178.                 for i = 1,#v do
  179.                 s,e=string.lower(msg):find(v[i])
  180.                         if s ~= nil and e ~= nil then
  181.                                 if s == e-(v[i]:len()-1) then
  182.                                 keyvals[v[i]]=true
  183.                                 end
  184.                         end
  185.                 end
  186.         end
  187.         wait()
  188.         if keyvals["computer"] then -- Base loop, make sure we said "computer" (Or whatever word you want to need for every command)
  189.                 if keyvals["program"] and keyvals["begin"] then -- Program loop
  190.                         if keyvals["courtney starling"] and not keyvals["winter fight"] and not keyvals["combat"] and not keyvals["arena"] and not keyvals["armoury"] then -- Finally, specific program name :3
  191.                                 if not checkEnv() then -- Make sure there's not already a program running
  192.                                 Program(game.Lighting["Courtney Starling"]) -- The function that controls everything
  193.                                 loadTools("cs")
  194.                                 end
  195.                         elseif keyvals["winter fight"] and not keyvals["combat"] and not keyvals["courtney starling"] and not keyvals["arena"] and not keyvals["boss fight"] and not keyvals["armoury"] and not keyvals["cave"] and not keyvals["meeting"] and not keyvals["tower"] then
  196.                                 if not checkEnv() then
  197.                                 Program(game.Lighting["Winter Fight"])
  198.                                 loadTools("winter")
  199.                                 end
  200.                         elseif keyvals["combat"] and not keyvals["winter fight"] and not keyvals["courtney starling"] and not keyvals["arena"] and not keyvals["boss fight"] and not keyvals["armoury"] and not keyvals["cave"] and not keyvals["meeting"]  and not keyvals["water fight"] and not keyvals["tower"] then
  201.                                 if not checkEnv() then
  202.                                 Program(game.Lighting["Combat"])
  203.                                 loadTools("combat")
  204.                                 end
  205.                         elseif keyvals["arena"] and not keyvals["winter fight"] and not keyvals["courtney starling"] and not keyvals["combat"] and not keyvals["boss fight"] and not keyvals["armoury"] and not keyvals["cave"] and not keyvals["meeting"]  and not keyvals["water fight"] and not keyvals["bunker"] and not keyvals["tower"]  then
  206.                                 if not checkEnv() then
  207.                                 Program(game.Lighting["Arena"])
  208.                                 loadTools("arena")
  209.                                 end
  210.          elseif keyvals["boss fight"] and not keyvals["winter fight"] and not keyvals["courtney starling"] and not keyvals["combat"] and not keyvals["arena"] and not keyvals["armoury"] and not keyvals["cave"] and not keyvals["meeting"]  and not keyvals["water fight"] and not keyvals["bunker"] and not keyvals["tower"]  then
  211.                                 if not checkEnv() then
  212.                                 Program(game.Lighting["Boss Fight"])
  213.                                 loadTools("boss")
  214.                                 end
  215.          elseif keyvals["armoury"] and not keyvals["winter fight"] and not keyvals["courtney starling"] and not keyvals["combat"] and not keyvals["arena"] and not keyvals["boss fight"] and not keyvals["cave"] and not keyvals["meeting"]  and not keyvals["water fight"] and not keyvals["bunker"] and not keyvals["tower"]  then
  216.                                 if not checkEnv() then
  217.                                 Program(game.Lighting["Armoury"])
  218.                                 loadTools("boss")
  219.                                 end
  220.          elseif keyvals["cave"] and not keyvals["winter fight"] and not keyvals["courtney starling"] and not keyvals["combat"] and not keyvals["arena"] and not keyvals["boss fight"] and not keyvals["armoury"] and not keyvals["meeting"]  and not keyvals["water fight"] and not keyvals["bunker"] and not keyvals["tower"]  then
  221.                                 if not checkEnv() then
  222.                                 Program(game.Lighting["Cave"])
  223.                                 loadTools("cave")
  224.                                 end
  225.          elseif keyvals["water fight"] and not keyvals["winter fight"] and not keyvals["courtney starling"] and not keyvals["combat"] and not keyvals["arena"] and not keyvals["boss fight"] and not keyvals["armoury"] and not keyvals["meeting"]  and not keyvals["cave"] and not keyvals["bunker"] and not keyvals["tower"] then
  226.                                 if not checkEnv() then
  227.                                 Program(game.Lighting["Water Fight"])
  228.                                 loadTools("water fight")
  229.                                 end
  230.          elseif keyvals["bunker"] and not keyvals["winter fight"] and not keyvals["courtney starling"] and not keyvals["combat"] and not keyvals["arena"] and not keyvals["boss fight"] and not keyvals["armoury"] and not keyvals["meeting"]  and not keyvals["cave"] and not keyvals["water fight"] and not keyvals["tower"] then
  231.                                 if not checkEnv() then
  232.                                 Program(game.Lighting["Bunker"])
  233.                                 loadTools("bunker")
  234.                                 end
  235.          elseif keyvals["meeting"] and not keyvals["winter fight"] and not keyvals["courtney starling"] and not keyvals["combat"] and not keyvals["arena"] and not keyvals["boss fight"] and not keyvals["armoury"] and not keyvals["bunker"]  and not keyvals["cave"] and not keyvals["tower"] and not keyvals["water fight"] then
  236.                                 if not checkEnv() then
  237.                                 Program(game.Lighting["Meeting"])
  238.                                 loadTools("meeting")
  239.                                 end
  240.          elseif keyvals["tower"] and not keyvals["winter fight"] and not keyvals["courtney starling"] and not keyvals["combat"] and not keyvals["arena"] and not keyvals["boss fight"] and not keyvals["armoury"] and not keyvals["bunker"]  and not keyvals["cave"] and not keyvals["water fight"] and not keyvals["meeting"] then
  241.                                 if not checkEnv() then
  242.                                 Program(game.Lighting["Tower"])
  243.                                 loadTools("tower")
  244.                                 end
  245.                         elseif keyvals["test"] and not keyvals ["tower"] and not keyvals["winter fight"] and not keyvals["courtney starling"] and not keyvals["combat"] and not keyvals["arena"] and not keyvals["boss fight"] and not keyvals["armoury"] and not keyvals["bunker"]  and not keyvals["cave"] and not keyvals["water fight"] and not keyvals["meeting"] then
  246.                                 if not checkEnv() then
  247.                                 Program(game.Lighting["Stasis"])
  248.                                 loadTools("test")
  249.                                 end
  250.                         end
  251.                 elseif keyvals["program"] and keyvals["end"] then
  252.                         for _,v in pairs(workspace:GetChildren()) do
  253.                                 if v:FindFirstChild("Environment") then
  254.                                 Program(v,true) -- The second argument is "Off", which tells the script whether we're creating or removing a program
  255.                                 loadTools("nil")
  256.                                 end
  257.                         end
  258.                 end
  259.         end
  260. end