Thread:Pdgrobloxking/@comment-26919612-20150823121543

assert(workspace:FindFirstChild("Generator")~=nil,"There is no Generator model!")





gs = {}



trainers = {"player","lordawersomeemperor"}



function globalScript(s)

yes = false

for i = 1,#gs do

if s.Name == gs[i] then

yes = true

break

end

end

return yes

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">

<p style="margin-top:0px;margin-bottom:0px;">game.Players.PlayerAdded:connect(function(player)

<p style="margin-top:0px;margin-bottom:0px;">for i=1,#trainers do

<p style="margin-top:0px;margin-bottom:0px;">if trainers[i]==player.Name then

<p style="margin-top:0px;margin-bottom:0px;">player.Chatted:connect(onDoorSpeak)

<p style="margin-top:0px;margin-bottom:0px;">break

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">end)

<p style="margin-top:0px;margin-bottom:0px;">

<p style="margin-top:0px;margin-bottom:0px;">game.Players.PlayerAdded:connect(function(player)

<p style="margin-top:0px;margin-bottom:0px;">if player:GetRankInGroup(1235826) >= 13 then

<p style="margin-top:0px;margin-bottom:0px;">trainers[#trainers+1] = player.Name

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">for i=1,#trainers do

<p style="margin-top:0px;margin-bottom:0px;">if trainers[i]==player.Name then

<p style="margin-top:0px;margin-bottom:0px;">player.Chatted:connect(onDoorSpeak)

<p style="margin-top:0px;margin-bottom:0px;">break

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">end)

<p style="margin-top:0px;margin-bottom:0px;">

<p style="margin-top:0px;margin-bottom:0px;">

<p style="margin-top:0px;margin-bottom:0px;">

<p style="margin-top:0px;margin-bottom:0px;">function checkEnv

<p style="margin-top:0px;margin-bottom:0px;">yes = false

<p style="margin-top:0px;margin-bottom:0px;">for _,v in pairs(workspace:GetChildren) do

<p style="margin-top:0px;margin-bottom:0px;">if v:FindFirstChild("Environment") then

<p style="margin-top:0px;margin-bottom:0px;">yes = true

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">return yes

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">

<p style="margin-top:0px;margin-bottom:0px;">envtools = {

<p style="margin-top:0px;margin-bottom:0px;">["nil"] = {};

<p style="margin-top:0px;margin-bottom:0px;">["team"] = {"ATK"};

<p style="margin-top:0px;margin-bottom:0px;">["sword"] = {"Sword"};

<p style="margin-top:0px;margin-bottom:0px;">["gun"] = {"Carbine"};

<p style="margin-top:0px;margin-bottom:0px;">["both"] = {"Sword", "Carbine-(30)"};

<p style="margin-top:0px;margin-bottom:0px;">}

<p style="margin-top:0px;margin-bottom:0px;">

<p style="margin-top:0px;margin-bottom:0px;">tloc = {"Backpack","StarterGear"}

<p style="margin-top:0px;margin-bottom:0px;">

<p style="margin-top:0px;margin-bottom:0px;">function resetTools(Player)

<p style="margin-top:0px;margin-bottom:0px;">for _,btool in pairs(Player.Backpack:GetChildren) do

<p style="margin-top:0px;margin-bottom:0px;">btool:Remove

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">for _,stool in pairs(Player.StarterGear:GetChildren) do

<p style="margin-top:0px;margin-bottom:0px;">stool:Remove

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">

<p style="margin-top:0px;margin-bottom:0px;">function loadTools(start)

<p style="margin-top:0px;margin-bottom:0px;">for _,v in pairs(game.Players:GetPlayers) do

<p style="margin-top:0px;margin-bottom:0px;">resetTools(v)

<p style="margin-top:0px;margin-bottom:0px;">for key,val in pairs(envtools) do

<p style="margin-top:0px;margin-bottom:0px;">if string.lower(key) == string.lower(start) then

<p style="margin-top:0px;margin-bottom:0px;">for _,tool in pairs(val) do

<p style="margin-top:0px;margin-bottom:0px;">if game.Lighting:FindFirstChild(tool) then

<p style="margin-top:0px;margin-bottom:0px;">local t = game.Lighting:FindFirstChild(tool)

<p style="margin-top:0px;margin-bottom:0px;">for i = 1,#tloc do

<p style="margin-top:0px;margin-bottom:0px;">t:Clone.Parent = v[tloc[i]]

<p style="margin-top:0px;margin-bottom:0px;">wait

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">

<p style="margin-top:0px;margin-bottom:0px;">---

<p style="margin-top:0px;margin-bottom:0px;">

<p style="margin-top:0px;margin-bottom:0px;">function Select(Brick,Color)

<p style="margin-top:0px;margin-bottom:0px;">s = Instance.new("SelectionBox",Brick)

<p style="margin-top:0px;margin-bottom:0px;">s.Color = BrickColor.new(Color)

<p style="margin-top:0px;margin-bottom:0px;">s.Adornee = Brick

<p style="margin-top:0px;margin-bottom:0px;">workspace.Generator.Connection.Part = Brick

<p style="margin-top:0px;margin-bottom:0px;">workspace.Generator.Connection.Color = BrickColor.new(Color)

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">

<p style="margin-top:0px;margin-bottom:0px;">function Deselect(Brick)

<p style="margin-top:0px;margin-bottom:0px;">if Brick:FindFirstChild("SelectionBox") then

<p style="margin-top:0px;margin-bottom:0px;">Brick.SelectionBox:Remove

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">workspace.Generator.Connection.Part = nil

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">

<p style="margin-top:0px;margin-bottom:0px;">function start(Environment,Off)

<p style="margin-top:0px;margin-bottom:0px;">if not Off then

<p style="margin-top:0px;margin-bottom:0px;">newEnv = Instance.new("Model",workspace)

<p style="margin-top:0px;margin-bottom:0px;">newEnv.Name = Environment.Name

<p style="margin-top:0px;margin-bottom:0px;">envTag = Instance.new("NumberValue",newEnv)

<p style="margin-top:0px;margin-bottom:0px;">envTag.Name = "Environment"

<p style="margin-top:0px;margin-bottom:0px;">for _,v in pairs(Environment:GetChildren) do

<p style="margin-top:0px;margin-bottom:0px;">if v:IsA("BasePart") then

<p style="margin-top:0px;margin-bottom:0px;">cframe = v.CFrame

<p style="margin-top:0px;margin-bottom:0px;">newP = v:Clone

<p style="margin-top:0px;margin-bottom:0px;">newP.Parent = newEnv

<p style="margin-top:0px;margin-bottom:0px;">newP.CFrame = cframe

<p style="margin-top:0px;margin-bottom:0px;">Select(newP,"Earth green")

<p style="margin-top:0px;margin-bottom:0px;">wait

<p style="margin-top:0px;margin-bottom:0px;">Deselect(newP)

<p style="margin-top:0px;margin-bottom:0px;">elseif v:IsA("Script") then

<p style="margin-top:0px;margin-bottom:0px;">if globalScript(v) then

<p style="margin-top:0px;margin-bottom:0px;">newS = v:Clone

<p style="margin-top:0px;margin-bottom:0px;">newS.Parent = newEnv

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">m = Instance.new("Message",workspace)

<p style="margin-top:0px;margin-bottom:0px;">m.Text = ""..string.upper(Environment.Name).." is finished. Enter when instructed." -- Edit this to whatever you want, or remove it

<p style="margin-top:0px;margin-bottom:0px;">wait(5)

<p style="margin-top:0px;margin-bottom:0px;">m:Remove

<p style="margin-top:0px;margin-bottom:0px;">elseif Off then

<p style="margin-top:0px;margin-bottom:0px;">for _,v in pairs(Environment:GetChildren) do

<p style="margin-top:0px;margin-bottom:0px;">if v:IsA("BasePart") then

<p style="margin-top:0px;margin-bottom:0px;">Select(v,"White")

<p style="margin-top:0px;margin-bottom:0px;">wait

<p style="margin-top:0px;margin-bottom:0px;">v:Remove

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">wait(0.1)

<p style="margin-top:0px;margin-bottom:0px;">Environment:Remove

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">

<p style="margin-top:0px;margin-bottom:0px;">

<p style="margin-top:0px;margin-bottom:0px;">function onDoorSpeak(msg,recip)

<p style="margin-top:0px;margin-bottom:0px;">

<p style="margin-top:0px;margin-bottom:0px;">keywords = {

<p style="margin-top:0px;margin-bottom:0px;">sample = {"computer","end","start","ffa1","obby1","obby2","sft","terrain"}; --change the maps on G by your maps in ligthing

<p style="margin-top:0px;margin-bottom:0px;">}

<p style="margin-top:0px;margin-bottom:0px;">

<p style="margin-top:0px;margin-bottom:0px;">keyvals = {

<p style="margin-top:0px;margin-bottom:0px;">["computer"] = false;

<p style="margin-top:0px;margin-bottom:0px;">["end"] = false;

<p style="margin-top:0px;margin-bottom:0px;">["start"] = false;

<p style="margin-top:0px;margin-bottom:0px;">["ffa1"] = false;

<p style="margin-top:0px;margin-bottom:0px;">["obby1"] = false;

<p style="margin-top:0px;margin-bottom:0px;">["obby2"] = false;

<p style="margin-top:0px;margin-bottom:0px;">["sft"] = false;

<p style="margin-top:0px;margin-bottom:0px;">["terrain"] = false;

<p style="margin-top:0px;margin-bottom:0px;">}

<p style="margin-top:0px;margin-bottom:0px;">

<p style="margin-top:0px;margin-bottom:0px;">for _,v in pairs(keywords) do

<p style="margin-top:0px;margin-bottom:0px;">for i = 1,#v do

<p style="margin-top:0px;margin-bottom:0px;">s,e=string.lower(msg):find(v[i])

<p style="margin-top:0px;margin-bottom:0px;">if s ~= nil and e ~= nil then

<p style="margin-top:0px;margin-bottom:0px;">if s == e-(v[i]:len-1) then

<p style="margin-top:0px;margin-bottom:0px;">keyvals[v[i]]=true

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">wait

<p style="margin-top:0px;margin-bottom:0px;">if keyvals["computer"] then

<p style="margin-top:0px;margin-bottom:0px;">if keyvals["start"] then

<p style="margin-top:0px;margin-bottom:0px;">if keyvals["ffa1"] and not keyvals["obby1"] and not keyvals["obby2"] and not keyvals["sft"] and not keyvals["terrain"] then

<p style="margin-top:0px;margin-bottom:0px;">if not checkEnv then

<p style="margin-top:0px;margin-bottom:0px;">start(game.Lighting["FFA1"])

<p style="margin-top:0px;margin-bottom:0px;">loadTools("sword")

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">elseif keyvals["obby1"] and not keyvals["ffa1"] and not keyvals["obby2"] and not keyvals["sft"] and not keyvals["terrain"] then

<p style="margin-top:0px;margin-bottom:0px;">if not checkEnv then

<p style="margin-top:0px;margin-bottom:0px;">start(game.Lighting["Obby1"])

<p style="margin-top:0px;margin-bottom:0px;">loadTools("nil")

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">elseif keyvals["obby2"] and not keyvals["ffa1"] and not keyvals["obby1"] and not keyvals["sft"] and not keyvals["terrain"] then

<p style="margin-top:0px;margin-bottom:0px;">if not checkEnv then

<p style="margin-top:0px;margin-bottom:0px;">start(game.Lighting["Obby2"])

<p style="margin-top:0px;margin-bottom:0px;">loadTools("nil")

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">elseif keyvals["sft"] and not keyvals["obby1"] and not keyvals["obby2"] and not keyvals["ffa1"] and not keyvals["terrain"] then

<p style="margin-top:0px;margin-bottom:0px;">if not checkEnv then

<p style="margin-top:0px;margin-bottom:0px;">start(game.Lighting["SFT"])

<p style="margin-top:0px;margin-bottom:0px;">loadTools("nil")

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">elseif keyvals["terrain"] and not keyvals["obby1"] and not keyvals["obby2"] and not keyvals["sft"] and not keyvals["ffa1"] then

<p style="margin-top:0px;margin-bottom:0px;">if not checkEnv then

<p style="margin-top:0px;margin-bottom:0px;">start(game.Lighting["Terrain"])

<p style="margin-top:0px;margin-bottom:0px;">loadTools("sword")

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">elseif keyvals["end"] then

<p style="margin-top:0px;margin-bottom:0px;">for i, player in pairs(game.Players:GetPlayers) do

<p style="margin-top:0px;margin-bottom:0px;">player.Character.Torso.CFrame = CFrame.new(-17.1, 18.504, 92.101)

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">for _,v in pairs(workspace:GetChildren) do

<p style="margin-top:0px;margin-bottom:0px;">if v:FindFirstChild("Environment") then

<p style="margin-top:0px;margin-bottom:0px;">start(v,true)

<p style="margin-top:0px;margin-bottom:0px;">loadTools("nil")

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">end

<p style="margin-top:0px;margin-bottom:0px;">end <ac_metadata title="holo training scripting + configuration change all maps on G to your maps"> </ac_metadata>