Roblox/luau_corpus huggingface dataset:
--// All global vars will be wiped/replaced except script

return function(data, env)
	if env then
		setfenv(1, env)
	end

	local UI = client.UI

	local gui = service.New("ScreenGui", {ResetOnSpawn = false})
	local gTable = UI.Register(gui)

	if UI.Get("HelpButton", gui, true) then
		gui:Destroy()
		gTable:Destroy()
		return nil
	end

	gTable.Name = "HelpButton"
	gTable.CanKeepAlive = true

	local toggle = service.New("ImageButton", {
		Parent = gui;
		Name = "Toggle";
		BackgroundTransparency = 1;
		Position = UDim2.new(1, -45, 1, -45);
		Size = UDim2.fromOffset(40, 40);
		Image = client.HelpButtonImage;
		ImageTransparency = 0.5;
	})

	--if UI.Get("Chat") then
	--	toggle.Position = UDim2.new(1, -(45+40),1, -45)
	--end

	toggle.MouseButton1Down:Connect(function()
		local found = UI.Get("UserPanel", nil, true)
		if found then
			found.Object:Destroy()
		else
			UI.Make("UserPanel")
		end
	end)

	gTable:Ready()
end
----- Frames -----

local GiftFrame = ScreenGui.ClaimGift.GiftFrame
local DailyRewardFrame = ScreenGui.DailyReward.DailyRewardFrame
local RebirthFrame = ScreenGui.Rebirth.RebirthFrame
local StoreFrame = ScreenGui.Store.StoreFrame
local VipFrame = ScreenGui.VIP.VipFrame
local InventoryFrame = ScreenGui.Inventory.InventoryFrame
local CaseStoreFrame = ScreenGui.CaseShop.CaseShopFrame
--m3.Volume = 0
m2.Looped = false
m2.Playing = false
script.Parent.Parent:WaitForChild("Drive").Locotrol.Event:connect(function(data)
	if data["Horn"] == true then
		m2.Volume = 0
		m2.Looped = false
		m2:Stop()
		m2.Playing = false
		--m3.Volume = 0
		--m3.Stop()
		m1.Volume = 7.5
		m1:Play()
		--wait(m1.TimeLength) --disabled because it makes looping part stuck playing if stopped too soon.
		if m1.TimePosition < m1.TimeLength then
			m2.Looped = true
			m2.Volume = 7.5
			m2:Play()
		else
			m1.Volume = 0
			m1:Stop()
		end
	elseif data["Horn"] == false then
		m1.Volume = 0
		m1:Stop()
		--[[ --For 3 part option
		m2.Volume = 0
		m2:Stop()
		m2.Looped = false
		m2.Playing = false
		m3.Volume = 1
		m3:Play()
		--]]
		----[[ -- For 2 part option
		if m2.IsPlaying == true then
			for i=2, 0, -.2 do
				m2.Volume = i*1
				wait(.1)
			end
		end
		m2.Volume = 0
		m2.Looped = false
		m2.Playing = false
		m2:Stop()
		----]]	
	end
end)
--[[
    Create a ClientAvatarComponent for the given model
]]
function ClientAvatarComponent.new(model, userId)
	local component = {
		model = model
	}
	setmetatable(component, {__index = ClientAvatarComponent})

	local avatar = model:FindFirstChild(ReplicatedConstants.AVATAR_MODEL_NAME)
	component.avatar = avatar

	component:setupJoints()

	return component
end
-- same as jump for now

function moveFreeFall()
	RightShoulder.MaxVelocity = 0.5
	LeftShoulder.MaxVelocity = 0.5
	RightShoulder.DesiredAngle = (3.14)
	LeftShoulder.DesiredAngle = (-3.14)
	RightHip.DesiredAngle = (0)
	LeftHip.DesiredAngle = (0)
end

function moveSit()
	RightShoulder.MaxVelocity = 0.15
	LeftShoulder.MaxVelocity = 0.15
	RightShoulder.DesiredAngle = (3.14 /2)
	LeftShoulder.DesiredAngle = (-3.14 /2)
	RightHip.DesiredAngle = (3.14 /2)
	LeftHip.DesiredAngle = (-3.14 /2)
end

function getTool()	
	for _, kid in ipairs(Figure:GetChildren()) do
		if kid.className == "Tool" then return kid end
	end
	return nil
end

function getToolAnim(tool)
	for _, c in ipairs(tool:GetChildren()) do
		if c.Name == "toolanim" and c.className == "StringValue" then
			return c
		end
	end
	return nil
end

function animateTool()
	
	if (toolAnim == "None") then
		RightShoulder.DesiredAngle = (1.57)
		return
	end

	if (toolAnim == "Slash") then
		RightShoulder.MaxVelocity = 0.5
		RightShoulder.DesiredAngle = (0)
		return
	end

	if (toolAnim == "Lunge") then
		RightShoulder.MaxVelocity = 0.5
		LeftShoulder.MaxVelocity = 0.5
		RightHip.MaxVelocity = 0.5
		LeftHip.MaxVelocity = 0.5
		RightShoulder.DesiredAngle = (1.57)
		LeftShoulder.DesiredAngle = (1.0)
		RightHip.DesiredAngle = (1.57)
		LeftHip.DesiredAngle = (1.0)
		return
	end
end

function move(time)
	local amplitude
	local frequency
  
	if (pose == "Jumping") then
		moveJump()
		return
	end

	if (pose == "FreeFall") then
		moveFreeFall()
		return
	end
 
	if (pose == "Seated") then
		moveSit()
		return
	end

	local climbFudge = 0
	
	if (pose == "Running") then
		RightShoulder.MaxVelocity = 0.15
		LeftShoulder.MaxVelocity = 0.15
		amplitude = 1
		frequency = 9
	elseif (pose == "Climbing") then
		RightShoulder.MaxVelocity = 0.5 
		LeftShoulder.MaxVelocity = 0.5
		amplitude = 1
		frequency = 9
		climbFudge = 3.14
	else
		amplitude = 0.1
		frequency = 1
	end

	desiredAngle = amplitude * math.sin(time*frequency)

	RightShoulder.DesiredAngle = (desiredAngle + climbFudge)
	LeftShoulder.DesiredAngle = (desiredAngle - climbFudge)
	RightHip.DesiredAngle = (-desiredAngle)
	LeftHip.DesiredAngle = (-desiredAngle)


	local tool = getTool()

	if tool then
	
		animStringValueObject = getToolAnim(tool)

		if animStringValueObject then
			toolAnim = animStringValueObject.Value
			-- message recieved, delete StringValue
			animStringValueObject.Parent = nil
			toolAnimTime = time + .3
		end

		if time > toolAnimTime then
			toolAnimTime = 0
			toolAnim = "None"
		end

		animateTool()

		
	else
		toolAnim = "None"
		toolAnimTime = 0
	end
end
-- Test Module
-- Username
-- August 29, 2020



local TestModule = {}

function TestModule:Start()
	print("Test Module loaded.")

	self.Controllers.HelloController:SayHello()
	while (not TestModule.ABC) do
		wait()
	end
end

function TestModule:Init()

end

return TestModule
----------------------This is just an example-----------------------------
	script.Parent.Parent.Ammo.Visible = true
	script.Parent.Parent.Ammo.Text = ammo.value
--script.Parent.CCC.Velocity = script.Parent.CCC.CFrame.lookVector *script.Parent.Speed.Value
script.Parent.CCCC.Velocity = script.Parent.CCCC.CFrame.lookVector *script.Parent.Speed.Value
script.Parent.D.Velocity = script.Parent.D.CFrame.lookVector *script.Parent.Speed.Value
script.Parent.DD.Velocity = script.Parent.DD.CFrame.lookVector *script.Parent.Speed.Value
script.Parent.DDD.Velocity = script.Parent.DDD.CFrame.lookVector *script.Parent.Speed.Value
script.Parent.DDDD.Velocity = script.Parent.DDDD.CFrame.lookVector *script.Parent.Speed.Value
script.Parent.E.Velocity = script.Parent.E.CFrame.lookVector *script.Parent.Speed.Value
-- Battery1 --

Battery.Interaction.Touched:Connect(function(hit)
	if hit.Parent:IsA("Tool") and hit.Parent.Name == ToolRequired then
		Battery.Battery1.Transparency = 0
		if game.ReplicatedStorage.ItemSwitching.Value == true then
			hit.Parent:Destroy()
		end
		Battery.Parent.SoundPart.Insert:Play()
		Battery.Parent.Light2.Color = Color3.fromRGB(0,255,0)
		LocksLeft.Value = LocksLeft.Value - 1
		Battery.Battery1Script.Disabled = true
	end
end)

Battery.Interaction.ClickDetector.MouseClick:Connect(function(plr)
	if plr.Backpack:FindFirstChild(Battery.ToolRequired.Value) then
		Battery.Battery1.Transparency = 0
		if game.ReplicatedStorage.ItemSwitching.Value == true then
			plr.Backpack:FindFirstChild(ToolRequired):Destroy()
		end
		Battery.Parent.SoundPart.Insert:Play()
		Battery.Parent.Light2.Color = Color3.fromRGB(0,255,0)
		LocksLeft.Value = LocksLeft.Value - 1
		Battery.Battery1Script.Disabled = true
	end
end)
--[[Running Logic]]--
local equipped = false
local rayparts = {}
local ColorChoices = {BrickColor.new('Really red'),BrickColor.new('Lime green'),BrickColor.new('Toothpaste')}
local StartOffset = {Vector3.new(-.45,0,0),Vector3.new(0,0,0),Vector3.new(.45,0,0)}
local oldC0 =nil
local nweld
local EffectFunctions = 
{
	function(hum,dir) hum:TakeDamage(1) end,
	function(hum,dir) hum:TakeDamage(-1) end,
	function(hum,dir) 
		if hum.Torso then
			local nforce = Instance.new('BodyForce')
			nforce.force = dir*100
			nforce.Parent = hum.Torso
			hum.Sit = true
			game.Debris:AddItem(nforce,.2)
			Delay(.2,function() hum.Sit = false end)
		end
	end
}
Tool.Equipped:connect(function(mouse)
	--game.Players.LocalPlayer:GetMouse()
	Spawn(function()
		local colorChoice = 1
		if not Tool.Parent:FindFirstChild('Torso') or not Tool.Parent.Torso:FindFirstChild('Right Shoulder') or not Tool.Parent:FindFirstChild('Humanoid') then return end
		LazerSound:Play()
		nweld = Tool.Parent.Torso['Right Shoulder']
		oldC0 = nweld.C0
		nweld.CurrentAngle = 0
		nweld.DesiredAngle = 0
		nweld.MaxVelocity = 0
		mouse.Button1Down:connect(function()
			colorChoice=colorChoice+1
			if colorChoice>#ColorChoices then colorChoice =1 end
			LazerSound.Pitch = .75+((colorChoice*.25)*3)
		end)
		equipped = true
		while equipped and Tool.Parent:FindFirstChild('Torso') do
			local tframe = Tool.Parent.Torso.CFrame
			tframe = tframe + tframe:vectorToWorldSpace(Vector3.new(1, 0.5, 0))
			local taim = mouse.Hit.p -( tframe.p )
			nweld.C0 = (CFrame.new(Vector3.new(),tframe:vectorToObjectSpace(taim))*CFrame.Angles(0,math.pi/2,0))+Vector3.new( 1, 0.5, 0 )
			rayparts = CastLightRay(Handle.CFrame.p+Handle.CFrame:vectorToWorldSpace(StartOffset[colorChoice]),mouse.Hit.p,ColorChoices[colorChoice], 5, .2,rayparts, EffectFunctions[colorChoice])
			LazerSound.Volume = ((math.sin(tick()*3)+1)*.25)+.25
			wait()
		end
		nweld.C0 =oldC0
		LazerSound:Stop()
	end)
end)

Tool.Unequipped:connect(function(mouse)
	equipped= false
	LazerSound:Stop()
	for i=1,50,1 do
		if rayparts[i] then
			rayparts[i]:Destroy()
			rayparts[i]=nil		
		end
	end
	if nweld then
		nweld.MaxVelocity =.15
		nweld.C0 =oldC0
	end
	
end)
--
Edit = {
U = {{CFrame.new(0,0.03*(3.5/TimeOpen),0),TimeOpen*SL}},
D = {{CFrame.new(0,-0.03*(3.5/TimeOpen),0),TimeOpen*SL}},
R = {{CFrame.new(-0.03*(3.5/TimeOpen),0,0),TimeOpen*SL,TimeOpen}},
L = {{CFrame.new(0.03*(3.5/TimeOpen),0,0),TimeOpen*SL,TimeOpen}},
}
WaitTime = 7.5
--Kinglime

while true do
script.Parent.Velocity = script.Parent.CFrame.lookVector *script.Parent.Speed.Value
wait(0.1)
end
-- Adds numParts more parts to the cache.
function PartCacheStatic:Expand(numParts: number): ()
	assert(getmetatable(self) == PartCacheStatic, ERR_NOT_INSTANCE:format("Expand", "PartCache.new"))
	if numParts == nil then
		numParts = self.ExpansionSize
	end

	for i = 1, numParts do
		table.insert(self.Open, MakeFromTemplate(self.Template, self.CurrentCacheParent))
	end
end
--DO NOT CHANGE ANYTHING INSIDE OF THIS SCRIPT BESIDES WHAT YOU ARE TOLD TO UNLESS YOU KNOW WHAT YOU'RE DOING OR THE SCRIPT WILL NOT WORK!!
local hitPart = script.Parent
local debounce = true
local tool = game.ServerStorage.SuperSpeedRibbon -- Change "Sword" to the name of your tool, make sure your tool is in ServerStorage

hitPart.Touched:Connect(function(hit)
	if debounce == true then
		if hit.Parent:FindFirstChild("Humanoid") then
			local plr = game.Players:FindFirstChild(hit.Parent.Name)
			if plr then
				debounce = false
				hitPart.BrickColor = BrickColor.new("Bright red")
				tool:Clone().Parent = plr.Backpack
				wait(3) -- Change "3" to however long you want the player to have to wait before they can get the tool again
				debounce = true
				hitPart.BrickColor = BrickColor.new("Bright green")
			end
		end
	end
end)
--This will change all player's characters into R6 1.0.
--You can either modify this script or use another script to change the player's 'package'.
script:WaitForChild("R6 Camera").Parent = game.StarterPlayer.StarterPlayerScripts
script:WaitForChild("R6").Parent = game:GetService("ReplicatedStorage")
game.Players.PlayerAdded:connect(function(p)
	p.CharacterAdded:connect(function(c)
		if not p.Character:FindFirstChild("R6") then
			game.Workspace:WaitForChild(p.Name)
			local r = game:GetService("ReplicatedStorage"):WaitForChild("R6"):Clone()
			r.Name = p.Name
			r.Parent = game.Workspace
			r.HumanoidRootPart.CFrame = CFrame.new(c.HumanoidRootPart.Position)
			r:WaitForChild("Body Colors")
			c:WaitForChild("Body Colors")
			local b1 = r["Body Colors"]
			local b2 = c["Body Colors"]
			b1.HeadColor = b2.HeadColor
			b1.LeftArmColor = b2.LeftArmColor
			b1.LeftLegColor = b2.LeftLegColor
			b1.RightArmColor = b2.RightArmColor
			b1.RightLegColor = b2.RightLegColor
			b1.TorsoColor = b2.TorsoColor
			r:WaitForChild("Head"):WaitForChild("face").Texture = c.Head.face.Texture
			for _,h in pairs(c:GetChildren()) do
				if h.ClassName == "Accessory" or h.ClassName == "Hat" or h.ClassName == "Shirt" or h.ClassName == "Pants" or h.ClassName == "Shirt Graphic" then
					h.Parent = game.Workspace
					h.Parent = r
				end
			end
			c:Destroy()
			p.Character = r
			wait()
			p.Character:WaitForChild("Animate").Disabled = false
		end
	end)
end)
-----------------
--| Constants |--
-----------------

local GRAVITY_ACCELERATION = workspace.Gravity

local RELOAD_TIME = 3 -- Seconds until tool can be used again
local ROCKET_SPEED = 80 -- Speed of the projectile

local MISSILE_MESH_ID = 'http://www.roblox.com/asset/?id=2251534'
local MISSILE_MESH_SCALE = Vector3.new(0.35, 0.35, 0.25)
local ROCKET_PART_SIZE = Vector3.new(1.2, 1.2, 3.27)
--!strict
--[=[
  @function merge
  @within Set

  @param ... ...any -- The sets to merge.
  @return { [T]: boolean } -- The merged set.

  Combines one or more sets into a single set.

  Aliases: `join`, `union`

  ```lua
  local set1 = { hello = true, world = true }
  local set2 = { cat = true, dog = true, hello = true }

  local merge = Merge(set1, set2) -- { hello = true, world = true, cat = true, dog = true }
  ```
]=]
local function merge<T>(...: any): { [T]: boolean }
	local result = {}

	for setIndex = 1, select("#", ...) do
		local set = select(setIndex, ...)

		if type(set) ~= "table" then
			continue
		end

		for key, _ in pairs(set) do
			result[key] = true
		end
	end

	return result
end

return merge
--[[
	Returns the currentMinigame object
]]
function RoundController.getCurrentMinigame()
	return currentMinigame
end

return RoundController
--[=[
	Retrieves the full path of this datastore stage for diagnostic purposes.
	@return string
]=]
function DataStoreStage:GetFullPath()
	if self._loadParent then
		return self._loadParent:GetFullPath() .. "." .. tostring(self._loadName)
	else
		return tostring(self._loadName)
	end
end
--edit the function below to return true when you want this response/prompt to be valid
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data
return function(player, dialogueFolder)
	local plrData = require(game.ReplicatedStorage.Source.Modules.Util):GetPlayerData(player)
	return plrData.Classes.Base.Smasher.Obtained.Value == false
end
-- Unlock the camera:
function CamLock.Unlock()
	cam.CameraType = Enum.CameraType.Custom
	plane = nil
end


return CamLock
-- ROBLOX deviation: ansi-styles not ported

local CurrentModule = script
local Packages = CurrentModule.Parent

local LuauPolyfill = require(Packages.LuauPolyfill)
local Error = LuauPolyfill.Error
local Object = LuauPolyfill.Object
local extends = LuauPolyfill.extends
local isNaN = LuauPolyfill.Number.isNaN

local Collections = require(CurrentModule.Collections)
local printTableEntries = Collections.printTableEntries
local printListItems = Collections.printListItems

local AsymmetricMatcher = require(CurrentModule.plugins.AsymmetricMatcher)
local ConvertAnsi = require(CurrentModule.plugins.ConvertAnsi)
local RobloxInstance = require(CurrentModule.plugins.RobloxInstance)
local ReactElement = require(CurrentModule.plugins.ReactElement)
local ReactTestComponent = require(CurrentModule.plugins.ReactTestComponent)

local JestGetType = require(Packages.JestGetType)
local getType = JestGetType.getType
local isRobloxBuiltin = JestGetType.isRobloxBuiltin

local Types = require(CurrentModule.Types)
export type Colors = Types.Colors
export type CompareKeys = Types.CompareKeys
export type Config = Types.Config
export type Options = Types.Options
export type OptionsReceived = Types.OptionsReceived
export type OldPlugin = Types.OldPlugin
export type NewPlugin = Types.NewPlugin
export type Plugin = Types.Plugin
export type Plugins = Types.Plugins
export type PrettyFormatOptions = Types.PrettyFormatOptions
export type Printer = Types.Printer
export type Refs = Types.Refs
export type Theme = Types.Theme

local PrettyFormatPluginError = extends(Error, "PrettyFormatPluginError", function(self, message)
	self.name = "PrettyFormatPluginError"
	self.message = message
end)
-- Given a part, will return return the character from the given part.
function PartUtility.GetCharacterFromInstance_R(part)
	local model = part:FindFirstAncestorOfClass("Model")
	if model and model:FindFirstChild("Humanoid") then
		return model
	elseif model then
		PartUtility.GetCharacterFromInstance_R(model)
	end
end

function PartUtility.MakeInvisible(model)
	for _, child in pairs(model:GetDescendants()) do
		if child:IsA("BasePart") then
			child:SetAttribute("InitialTransparency",child.Transparency)
			child.Transparency = 1
		end
	end
end

function PartUtility.RestoreVisibility(model)
	for _, child in pairs(model:GetDescendants()) do
		if child:IsA("BasePart") then
			child.Transparency = child:GetAttribute("InitialTransparency") and child:GetAttribute("InitialTransparency") or 0
		end
	end
end

function PartUtility.MakeVisible(model)
	for _, child in pairs(model:GetDescendants()) do
		if child:IsA("BasePart") then
			child.Transparency = 0
		end
	end
end

return PartUtility
----- Connections -----

Players.PlayerAdded:Connect(function(player)
	PlayerReference[player] = true
end)

Players.PlayerRemoving:Connect(function(player)
	PlayerReference[player] = nil
	-- Automatic player reference cleanup:
	for rate_limiter in pairs(RateLimiters) do
		rate_limiter._sources[player] = nil
	end
end)

return RateLimiter
-- Copied from GenericButton. TODO: factor it out
return function(contentMap, controlState, style)
	local contentThemeClass = contentMap[controlState]
		or contentMap[ControlState.Default]

	local contentStyle = {
		Color = style.Theme[contentThemeClass].Color,
		Transparency = style.Theme[contentThemeClass].Transparency,
	}

	--Based on the design specs, the disabled and pressed state is 0.5 * alpha value
	if controlState == ControlState.Disabled or
		controlState == ControlState.Pressed then
			contentStyle.Transparency = 0.5 * contentStyle.Transparency + 0.5
	end
	return contentStyle
end
--------STAGE--------

game.Workspace.back1.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CustomScreen.Value)..""
game.Workspace.back2.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CustomScreen.Value)..""
game.Workspace.crewbig1.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CustomScreen.Value)..""
game.Workspace.crewsmall1.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CustomScreen.Value)..""
game.Workspace.djstand.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CustomScreen.Value)..""
game.Workspace.djtv.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CustomScreen.Value)..""
game.Workspace.side1.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CustomScreen.Value)..""
game.Workspace.side2.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CustomScreen.Value)..""
game.Workspace.side3.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CustomScreen.Value)..""
game.Workspace.side4.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CustomScreen.Value)..""
game.Workspace.side11.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CustomScreen.Value)..""
game.Workspace.side12.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CustomScreen.Value)..""
game.Workspace.sidebig1.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CustomScreen.Value)..""

if game.Workspace.CurrentStageTV.Value == "1" then
game.Workspace.main1.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CustomScreen.Value)..""
end
-- Services
local Teams = game:GetService("Teams")
local Workspace = game:GetService("Workspace")
local Debris = game:GetService("Debris")
local ContentProvider = game:GetService("ContentProvider")
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
--[=[
	Pops an entry from the left of the queue
	@return T
]=]
function Queue:PopLeft()
	if self._first > self._last then
		error("Queue is empty")
	end

	local value = self[self._first]
	self[self._first] = nil
	self._first = self._first + 1

	return value
end
--create tables:
for i,part in pairs(model:GetChildren()) do
	if string.sub(part.Name, 1,1) == "a" then
		table.insert(a, 1, part)
	end
end
for i,part in pairs(model:GetChildren()) do
	if string.sub(part.Name, 1,1) == "b" then
		table.insert(b, 1, part)
	end
end
for i,part in pairs(model:GetChildren()) do
	if string.sub(part.Name, 1,1) == "c" then
		table.insert(c, 1, part)
	end
end
for i,part in pairs(model:GetChildren()) do
	if string.sub(part.Name, 1,1) == "d" then
		table.insert(d, 1, part)
	end
end
for i,part in pairs(model:GetChildren()) do
	if string.sub(part.Name, 1,1) == "e" then
		table.insert(e, 1, part)
	end
end
for i,part in pairs(model:GetChildren()) do
	if string.sub(part.Name, 1,1) == "f" then
		table.insert(f, 1, part)
	end
end

function on(T)
	for i, part in pairs (T) do
		if part:FindFirstChild("SurfaceLight") then
			part.SurfaceLight.Enabled = true
		end
	    if part:FindFirstChild("SpotLight") then
			part.SpotLight.Enabled = true
		end
	end
end

function off(T)
	for i, part in pairs (T) do
		if part:FindFirstChild("SurfaceLight") then
			part.SurfaceLight.Enabled = false
		end
	    if part:FindFirstChild("SpotLight") then
			part.SpotLight.Enabled = false
		end
	end
end

function run() --mian

	off(a)--turns all lights off
	off(b)
	off(c)
	off(d)
	off(e)
	off(f)

	if pattern == "Flash" then
		repeat
			local w = 0.45
			off(c)
			off(d)
			on(a)
			on(b)
			on(e)
			on(f)
			wait(w)
			
			off(a)
			off(b)
			off(e)
			off(f)
			on(c)
			on(d)
			wait(w)
		
		until pattern ~= "Flash"
		return
	end

	if pattern == "Left" then
		repeat
		local w = 0.15
		on(f)
		wait(w)
		on(e)
		wait(w)
		on(d)
		wait(w)
		on(c)
		wait(w)
		on(b)
		wait(w)
		on(a)
		wait(w)
		
		off(f)
		wait(w)
		off(e)
		wait(w)
		off(d)
		wait(w)
		off(c)
		wait(w)
		off(b)
		wait(w)
		off(a)
		wait(w)
		until pattern ~= "Left"
		return
	end
	
	if pattern == "Right" then
		repeat
		local w = 0.15
		on(a)
		wait(w)
		on(b)
		wait(w)
		on(c)
		wait(w)
		on(d)
		wait(w)
		on(e)
		wait(w)
		on(f)
		wait(w)
		
		off(a)
		wait(w)
		off(b)
		wait(w)
		off(c)
		wait(w)
		off(d)
		wait(w)
		off(e)
		wait(w)
		off(f)
		wait(w)
		until pattern ~= "Right"
		return
	end
	
	if pattern == "Split" then
		repeat
		local w = 0.2
		on(c)
		on(d)
		wait(w)
		on(b)
		on(e)
		wait(w)
		on(a)
		on(f)
		wait(w)
		
		off(c)
		off(d)
		wait(w)
		off(b)
		off(e)
		wait(w)
		off(a)
		off(f)
		wait(w)
		until pattern ~= "Split"
		return
	end
end--run end