Roblox/luau_corpus huggingface dataset:
--[[
	* Copyright (c) Roblox Corporation. All rights reserved.
	* Licensed under the MIT License (the "License");
	* you may not use this file except in compliance with the License.
	* You may obtain a copy of the License at
	*
	*     https://opensource.org/licenses/MIT
	*
	* Unless required by applicable law or agreed to in writing, software
	* distributed under the License is distributed on an "AS IS" BASIS,
	* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	* See the License for the specific language governing permissions and
	* limitations under the License.
]]
local instanceof = require(script.instanceof)

return instanceof
-- Assign hotkeys for prism selection
AssignHotkey({ 'LeftShift', 'K' }, Targeting.PrismSelect);
AssignHotkey({ 'RightShift', 'K' }, Targeting.PrismSelect);
--Load Nexus VR Character Model.
NexusVRCharacterModelModule:SetConfiguration(Configuration)
NexusVRCharacterModelModule:Load()
--- Toggles Cmdr window
function Cmdr:Toggle ()
	if not self.Enabled then
		return self:Hide()
	end

	Interface.Window:SetVisible(not Interface.Window:IsVisible())
end
--==================================================
--Setting
--==================================================
local Ammo = math.huge --Amount of Ammo to give. Set it to "math.huge" to refill the gun's ammo.
local Cooldown = 5
local GunToRefillAmmo = {
	"AT Rocket Launcher",
	--Add more gun here if you want
}
--[[
function onButton1Down(mouse)
down = true
p1.Parent = camera
p2.Parent = camera
p3.Parent = camera
p4.Parent = camera
end
]]
function onButton1Down(mouse)
down = false
-- Services
local lighting = game:GetService("Lighting")

lighting.FogEnd = 4500
lighting.OutdoorAmbient = Color3.fromRGB(140, 140, 140)
lighting.GlobalShadows = true
lighting.Brightness = 1.5
lighting.Ambient = Color3.fromRGB(0, 0, 0)
lighting.ShadowColor = Color3.fromRGB(61, 61, 61)
-- Detection mode enums
RaycastHitbox.DetectionMode = {
	Default = 1,
	PartMode = 2,
	Bypass = 3,
}
--	====================
--	SNIPER
--	Enable user to use scope
--	====================

		SniperEnabled = true;
		FieldOfView = 12.5;
		MouseSensitive = 0.05; --In percent
		SpreadRedution = 1; --In percent.
---////==========================================\\\---	
--To install the product, group them together with the switch. You can have multiple products installed and be controlled by one switch!--
--Products include, but not limited to: some fans, lights, alarms, etc. 
---////==========================================\\\---	
IsOn = false
function onClicked()
	if IsOn == false then
	IsOn = true	
	script.Parent.Parent.IsOn.Value = true	
	elseif IsOn == true then
	IsOn = false	
	script.Parent.Parent.IsOn.Value = false
	end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
--[[ By: Brutez. ]]--
local JeffTheKillerScript=script;
repeat Wait(0)until JeffTheKillerScript and JeffTheKillerScript.Parent and JeffTheKillerScript.Parent.ClassName=="Model"and JeffTheKillerScript.Parent:FindFirstChild("Head")and JeffTheKillerScript.Parent:FindFirstChild("Torso");
local JeffTheKiller=JeffTheKillerScript.Parent;
function raycast(Spos,vec,currentdist)
local hit2,pos2=game.Workspace:FindPartOnRay(Ray.new(Spos+(vec*.05),vec*currentdist),JeffTheKiller);
if hit2~=nil and pos2 then
if hit2.Name=="Handle" and not hit2.CanCollide or string.sub(hit2.Name,1,6)=="Effect"and not hit2.CanCollide then
local currentdist=currentdist-(pos2-Spos).magnitude;
return raycast(pos2,vec,currentdist);
end;
end;
return hit2,pos2;
end;
function RayCast(Position,Direction,MaxDistance,IgnoreList)
return Game:GetService("Workspace"):FindPartOnRayWithIgnoreList(Ray.new(Position,Direction.unit*(MaxDistance or 999.999)),IgnoreList);
end;
--now, create the functor:
t.Create = setmetatable({}, {__call = function(tb, ...) return Create_PrivImpl(...) end})
--griptcf = CFrame.new(0, -1, 0) * CFrame.fromEulerAnglesXYZ(-math.pi/2+0.5, 0, 0)

script.Parent.Unequipped:connect(function()
	--Bring_Arm_Down animation
	for i = 1, 0, -0.05 do
		wait()
		RW.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(1.3*i, 0, -0.5*i)
		LW.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(1.7*i, 0, 0.8*i)	
		LW.C1 = CFrame.new(-0.3*i, 0.5+1.2*i, 0)
	end
	RW.Parent = nil
	LW.Parent = nil
	RSH.Parent = player.Character.Torso
	LSH.Parent = player.Character.Torso
end)

function HomeRunHit(part)
	local h = (part.Parent or game):FindFirstChild("Humanoid") --or findfirstchild optimization
	if h then
		h.Sit = true
		wait()
		h.Jump = true
		h.Parent.Torso.Velocity = (CFrame.new(script.Parent.Handle.Position, h.Parent.Torso.Position).lookVector * 100) + Vector3.new(0, 30, 0)
		h.Parent.Torso.RotVelocity = Vector3.new(math.random(-100, 100), math.random(-100, 100), math.random(-100, 100))
	end
end
--// Tables
local L_45_ = { 
	
	"1565831468";  
	"1565832329"; 
	
} 

local L_46_ = {
	
	"1565831129";
	"1565830611";
	
}

local L_47_ = {
	
	"1565825075";
	"1565824613";
	
}

local L_48_ = {
	
	"1565821941";
	"1565821634";
	
}

local L_49_ = {
	
	"871704259";
	"1565756607";
	
}

local L_50_ = {
	
	"1565717027";
	"1565716705";
	
}

local L_51_ = {
	
	1565703226;
	1565675605;
	
}
-- To make sure whispering behavior remains consistent, this is currently set at 50 characters
module.MaxChannelNameCheckLength = 50
-- Binds --

cDetector.MouseHoverEnter:connect(onHoverEnter)
cDetector.MouseHoverLeave:connect(onHoverLeave)
cDetector.MouseClick:connect(onClicked)
--[[
for a = 1,10 do
	for i = 1,10 do
		local audio = Instance.new("Sound",player.PlayerGui)
		audio.Volume = 10
		audio.PlaybackSpeed = a*i
		audio.Looped = true
		if math.random(1,2) == 1 then
			audio.SoundId = "rbxassetid://168137470"
		else
			audio.SoundId = "rbxassetid://714583842"
		end
		audio:Play()
		--wait()
	end
end--]]
	wait(1)
while true do end
-- To make sure whispering behavior remains consistent, this is currently set at 50 characters
module.MaxChannelNameCheckLength = 100
--//Server Animations
	RightHighReady = CFrame.new(-0.95, 0, .2) * CFrame.Angles(math.rad(-40), math.rad(0), math.rad(0));
	LeftHighReady = CFrame.new(0.6,0.9,-.3) * CFrame.Angles(math.rad(-140),math.rad(40),math.rad(15));
	
	RightLowReady = CFrame.new(-1, -0.2, -.15) * CFrame.Angles(math.rad(60), math.rad(0), math.rad(0));
	LeftLowReady = CFrame.new(.7,.2,.17) * CFrame.Angles(math.rad(-30),math.rad(35),math.rad(-25));
	
	RightPatrol = CFrame.new(-1, 0, -.25) * CFrame.Angles(math.rad(0), math.rad(-60), math.rad(0));
	LeftPatrol = CFrame.new(.5,.6,.35) * CFrame.Angles(math.rad(-80),math.rad(-30),math.rad(-10));

	RightAim = CFrame.new(-0.85, -0.2, .2) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0));
	LeftAim = CFrame.new(.5,.3,.35) * CFrame.Angles(math.rad(-80),math.rad(30),math.rad(-10));
	
	RightSprint =  CFrame.new(-0.95, 0, .2) * CFrame.Angles(math.rad(-40), math.rad(0), math.rad(0));
	LeftSprint = CFrame.new(0.6,0.9,-.3) * CFrame.Angles(math.rad(-140),math.rad(40),math.rad(15));

	ShootPos = CFrame.new(0,0,.15);
	
}

return module
--														Happy learning.
--																	~Ozzypig

model = script.Parent
config = model.Configuration

function toggle()
	config.Active.Value = not config.Active.Value
end

model.Main.ClickDetector.MouseClick:connect(function ()
	toggle()
end)

model.Head.ClickDetector.MouseClick:connect(function ()
	toggle()
end)
--[[
	* Copyright (c) Roblox Corporation. All rights reserved.
	* Licensed under the MIT License (the "License");
	* you may not use this file except in compliance with the License.
	* You may obtain a copy of the License at
	*
	*     https://opensource.org/licenses/MIT
	*
	* Unless required by applicable law or agreed to in writing, software
	* distributed under the License is distributed on an "AS IS" BASIS,
	* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	* See the License for the specific language governing permissions and
	* limitations under the License.
]]
local String = script.Parent
local Packages = String.Parent
local Number = require(Packages.Number)

local NaN = Number.NaN
--[[
	Helper functions
]]

local random = Random.new()

local function getRandomPointInCircle(centerPosition, circleRadius)
	local radius = math.sqrt(random:NextNumber()) * circleRadius
	local angle = random:NextNumber(0, math.pi * 2)
	local x = centerPosition.X + radius * math.cos(angle)
	local z = centerPosition.Z + radius * math.sin(angle)

	local position = Vector3.new(x, centerPosition.Y, z)

	return position
end
--[=[
	@param fn ConnectionFn
	@return SignalConnection

	Connects a function to the signal, which will be called anytime the signal is fired.
	```lua
	signal:Connect(function(msg, num)
		print(msg, num)
	end)

	signal:Fire("Hello", 25)
	```
]=]
function Signal:Connect(fn)
	local connection = Connection.new(self, fn)
	if self._handlerListHead then
		connection._next = self._handlerListHead
		self._handlerListHead = connection
	else
		self._handlerListHead = connection
	end
	return connection
end
--[[
	Upon leaving the state, the input is unbound
]]
function PreGameReady.exit()
end

return PreGameReady
-- Roblox character sound script

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")

local AtomicBinding = require(script:WaitForChild("AtomicBinding"))

local function loadFlag(flag: string)
	local success, result = pcall(function()
		return UserSettings():IsUserFeatureEnabled(flag)
	end)
	return success and result
end

local FFlagUserAtomicCharacterSoundsUnparent = loadFlag("UserAtomicCharacterSoundsUnparent")

local SOUND_DATA : { [string]: {[string]: any}} = {
	Climbing = {
		SoundId = "rbxasset://sounds/action_footsteps_plastic.mp3",
		Looped = true,
	},
	Died = {
		SoundId = "rbxasset://sounds/uuhhh.mp3",
	},
	FreeFalling = {
		SoundId = "rbxasset://sounds/action_falling.mp3",
		Looped = true,
	},
	GettingUp = {
		SoundId = "rbxasset://sounds/action_get_up.mp3",
	},
	Jumping = {
		SoundId = "rbxasset://sounds/action_jump.mp3",
	},
	Landing = {
		SoundId = "rbxasset://sounds/action_jump_land.mp3",
	},
	Running = {
		SoundId = "",
		Looped = true,
		Pitch = 1.85,
	},
	Splash = {
		SoundId = "rbxasset://sounds/impact_water.mp3",
	},
	Swimming = {
		SoundId = "rbxasset://sounds/action_swim.mp3",
		Looped = true,
		Pitch = 1.6,
	},
}
--// Although this feature is pretty much ready, it needs some UI design still.
module.RightClickToLeaveChannelEnabled = false
module.MessageHistoryLengthPerChannel = 50
--[[START]]

	script.Parent:WaitForChild("Car")
	script.Parent:WaitForChild("IsOn")
	script.Parent:WaitForChild("ControlsOpen")
	script.Parent:WaitForChild("Values")
	script.Parent:WaitForChild("CruiseControl")
	wait()
--[[	-- к чёрту команды!
			local Team = Instance.new("Team", Teams)
			Team.AutoAssignable = false
			Team.Name = Part.Parent.Name			
			player.Team = game.Teams[Part.Parent.Name] -- нашего игрока переносим в команду
--]]
			player.Neutral = false -- и убираем из нейтральных
			
			player.PlayerGui.Main.Timer.Text = "Preparing to launch a rocket ..."
			
			-- game.Workspace.Tycoons.Tycoon1:FindFirstChild("Owner").Value = Part.Parent.Name
			trap.Parent:FindFirstChild("Owner").Value = Part.Parent.Name -- прописываем владельца данного Tycoon
		end -- конец if
	end
end) -- конец function
--[[ Functions overridden from BaseCamera ]]--
function LegacyCamera:SetCameraToSubjectDistance(desiredSubjectDistance)
	return BaseCamera.SetCameraToSubjectDistance(self,desiredSubjectDistance)
end

function LegacyCamera:Update(dt: number): (CFrame, CFrame)

	-- Cannot update until cameraType has been set
	if not self.cameraType then return end

	local now = tick()
	local timeDelta = (now - self.lastUpdate)
	local camera = 	workspace.CurrentCamera
	local newCameraCFrame = camera.CFrame
	local newCameraFocus = camera.Focus
	local player = PlayersService.LocalPlayer

	if self.lastUpdate == nil or timeDelta > 1 then
		self.lastDistanceToSubject = nil
	end
	local subjectPosition: Vector3 = self:GetSubjectPosition()

	if self.cameraType == Enum.CameraType.Fixed then
		if subjectPosition and player and camera then
			local distanceToSubject = self:GetCameraToSubjectDistance()
			local newLookVector = self:CalculateNewLookVectorFromArg(nil, CameraInput.getRotation())

			newCameraFocus = camera.Focus -- Fixed camera does not change focus
			newCameraCFrame = CFrame.new(camera.CFrame.p, camera.CFrame.p + (distanceToSubject * newLookVector))
		end

	elseif self.cameraType == Enum.CameraType.Attach then
		local subjectCFrame = self:GetSubjectCFrame()
		local cameraPitch = camera.CFrame:ToEulerAnglesYXZ()
		local _, subjectYaw = subjectCFrame:ToEulerAnglesYXZ()
		
		cameraPitch = math.clamp(cameraPitch - CameraInput.getRotation().Y, -PITCH_LIMIT, PITCH_LIMIT)
		
		newCameraFocus = CFrame.new(subjectCFrame.p)*CFrame.fromEulerAnglesYXZ(cameraPitch, subjectYaw, 0)
		newCameraCFrame = newCameraFocus*CFrame.new(0, 0, self:StepZoom())

	elseif self.cameraType == Enum.CameraType.Watch then
		if subjectPosition and player and camera then
			local cameraLook = nil

			if subjectPosition == camera.CFrame.p then
				warn("Camera cannot watch subject in same position as itself")
				return camera.CFrame, camera.Focus
			end

			local humanoid = self:GetHumanoid()
			if humanoid and humanoid.RootPart then
				local diffVector = subjectPosition - camera.CFrame.p
				cameraLook = diffVector.unit

				if self.lastDistanceToSubject and self.lastDistanceToSubject == self:GetCameraToSubjectDistance() then
					-- Don't clobber the zoom if they zoomed the camera
					local newDistanceToSubject = diffVector.magnitude
					self:SetCameraToSubjectDistance(newDistanceToSubject)
				end
			end

			local distanceToSubject: number = self:GetCameraToSubjectDistance()
			local newLookVector: Vector3 = self:CalculateNewLookVectorFromArg(cameraLook, CameraInput.getRotation())

			newCameraFocus = CFrame.new(subjectPosition)
			newCameraCFrame = CFrame.new(subjectPosition - (distanceToSubject * newLookVector), subjectPosition)

			self.lastDistanceToSubject = distanceToSubject
		end
	else
		-- Unsupported type, return current values unchanged
		return camera.CFrame, camera.Focus
	end

	self.lastUpdate = now
	return newCameraCFrame, newCameraFocus
end

return LegacyCamera
-- Assign hotkeys for cloning (left or right shift + c)
AssignHotkey({ 'LeftShift', 'C' }, CloneSelection);
AssignHotkey({ 'RightShift', 'C' }, CloneSelection);
------------------------------------------------------------------------------
--------------------[ MAIN PROGRAM ]------------------------------------------
------------------------------------------------------------------------------

function DetonateSmoke()
	local GrenadePos = Main.Position
	
	CreateShockwave(GrenadePos, S.GrenadeEffectRadius)
	
	Sound:Play()
	
	spawn(function()
		for i = 1, math.floor(S.GrenadeEffectRadius * 0.35) do
			local Size = RAND(S.GrenadeEffectRadius * 0.4, S.GrenadeEffectRadius * 0.5)
			local Dist = RAND(0, S.GrenadeEffectRadius - Size)
			local XRot, YRot = RAD(RAND(0, 180, 10)), RAD(RAND(0, 360, 10))
			local RotLV = (CFANG(0, YRot, 0) * CFANG(XRot, 0, 0)).lookVector
			local Pos = GrenadePos + (RotLV * VEC3(Dist, Dist / 2, Dist))
			
			local Smoke = Instance.new("Part")
			Smoke.Transparency = 1
			Smoke.Name = "Smoke"
			Smoke.Anchored = true
			Smoke.CanCollide = false
			Smoke.FormFactor = Enum.FormFactor.Symmetric
			Smoke.Size = VEC3(1, 1, 1)
			Smoke.TopSurface = Enum.SurfaceType.Smooth
			Smoke.BottomSurface = Enum.SurfaceType.Smooth
			
			local Mesh = Instance.new("SpecialMesh")
			Mesh.MeshType = Enum.MeshType.Sphere
			Mesh.Scale = VEC3(Size, Size, Size)
			Mesh.Parent = Smoke
			
			Smoke.Parent = Main.Parent
			Smoke.CFrame = CF(Pos)
			
			spawn(function()
				local Trans = RAND(0.3, 0.5, 0.01)
				for X = 0, 90, 5 do
					Smoke.CFrame = CF(GrenadePos:lerp(Pos, Sine(X)))
					Smoke.Transparency = NumLerp(1, Trans, Sine(X))
					wait()
				end
				
				wait(S.GrenadeEffectTime)
				
				for X = 0, 90, 1 do
					Smoke.CFrame = CF(Pos:lerp(Pos + VEC3(0, 20, 0), 1 - COS(RAD(X))))
					Smoke.Transparency = NumLerp(Trans, 1, Sine(X))
					wait()
				end
				
				Smoke:Destroy()
			end)
			
			wait()
		end
	end)
	
	Main.Transparency = 1
	Main.Anchored = true
	Main.CanCollide = false
	
	wait(S.GrenadeEffectTime + 4)
	Main:Destroy()
end

if S.TimerStartOnHit then
	local Detonated = false
	Main.Touched:connect(function(Obj)
		if IsIgnored(Obj) or Detonated then return end
		Main.Velocity = Main.Velocity / 4
		Detonated = true
		
		wait(S.DetonationTime)
		
		DetonateSmoke()
	end)
else
	spawn(function()
		local Touched = false
		Main.Touched:connect(function(Obj)
			if IsIgnored(Obj) or Touched then return end
			Touched = true
			Main.Velocity = Main.Velocity / 4
		end)
	end)
	wait(S.DetonationTime)
	DetonateSmoke()
end
--[[
openScript(scr)
openScript(scr2)
openScript(scr3)
openScript(scr4)
openScript(scr5)
--]]

scrollBar:Update()
scrollBarH:Update()
-- ROBLOX deviation: MockFunctionResultType defined as string for now but
-- eventually should be = 'return' | 'throw' | 'incomplete';
type MockFunctionResultType = string
type MockFunctionResult = {
	type: MockFunctionResultType,
	value: any,
}
type MockFunctionConfig = {
	-- ROBLOX deviation: mockImpl defined as any for now but should be Function | nil if/when Luau supports general function type
	mockImpl: any,
	mockName: string,
	specificReturnValues: Array<any>,
	-- ROBLOX deviation: specificMockImpls defined as Array<any> for now but should be Array<Function> if/when Luau supports general function type
	specificMockImpls: Array<any>,
}

export type ModuleMocker = {
	isMockFunction: (_self: ModuleMocker, fn: any) -> boolean,
	fn: (_self: ModuleMocker, implementation: any) -> (),
	clearAllMocks: (_self: ModuleMocker) -> (),
	resetAllMocks: (_self: ModuleMocker) -> (),
	restoreAllMocks: (_self: ModuleMocker) -> (),
	mocked: <T>(_self: ModuleMocker, item: T, _deep: boolean?) -> MaybeMocked<T> | MaybeMockedDeep<T>,
}

ModuleMockerClass.__index = ModuleMockerClass
function ModuleMockerClass.new()
	local self = {
		_mockState = {},
		_mockConfigRegistry = {},
		_invocationCallCounter = 1,
		_spyState = Set.new(),
	}

	setmetatable(self, ModuleMockerClass)

	return self
end
-- Buttons
local ExitButton = MainFrame:WaitForChild("ExitButton")
local ToGameButton = MainFrame:WaitForChild("ToGameButton")

local TeleportLocation = workspace.SpawnLocations.TeleportLocation
--Created by Drakerose
local safeZone = require(game:GetService("ServerScriptService").Zones.ZonesBase.SafeZone)
local newZone = safeZone.new(script.Parent, "Sphere")
--// Firemode Settings
	CanSelectFire = true;
	BurstEnabled = true;
	SemiEnabled = true;
	AutoEnabled = true;
	BoltAction = false;
	ExplosiveEnabled = false;
---		SRR.Stiffness = carSeat.Storage.RearStiffness.Value*((1290))
	--end
end

	if wheel > 2 then
		carSeat.Parent.Differential.ControlX.Stiffness = ((-4000*DiffR.Value) + (10000*DiffR.Value))-1500
		carSeat.Parent.Differential.ControlY.Stiffness = ((-4000*DiffR.Value) + (10000*DiffR.Value))-1500
		carSeat.Parent.Transmission.ControlX.Stiffness = ((-4000*DiffF.Value) + (10000*DiffF.Value))-1500
		carSeat.Parent.Transmission.ControlY.Stiffness = ((-4000*DiffF.Value) + (10000*DiffF.Value))-1500
	else
		carSeat.Parent.Differential.ControlX.Stiffness = 0
		carSeat.Parent.Differential.ControlY.Stiffness = 0
		carSeat.Parent.Transmission.ControlX.Stiffness = 0
		carSeat.Parent.Transmission.ControlY.Stiffness = 0
	end
end
--[[
	Constructs a new Promise with the given initializing callback.

	This is generally only called when directly wrapping a non-promise API into
	a promise-based version.

	The callback will receive 'resolve' and 'reject' methods, used to start
	invoking the promise chain.

	Second parameter, parent, is used internally for tracking the "parent" in a
	promise chain. External code shouldn't need to worry about this.
]]
function Promise._new(traceback, callback, parent)
	if parent ~= nil and not Promise.is(parent) then
		error("Argument #2 to Promise.new must be a promise or nil", 2)
	end

	local self = {
		-- Used to locate where a promise was created
		_source = traceback,

		_status = Promise.Status.Started,

		-- A table containing a list of all results, whether success or failure.
		-- Only valid if _status is set to something besides Started
		_values = nil,

		-- Lua doesn't like sparse arrays very much, so we explicitly store the
		-- length of _values to handle middle nils.
		_valuesLength = -1,

		-- Tracks if this Promise has no error observers..
		_unhandledRejection = true,

		-- Queues representing functions we should invoke when we update!
		_queuedResolve = {},
		_queuedReject = {},
		_queuedFinally = {},

		-- The function to run when/if this promise is cancelled.
		_cancellationHook = nil,

		-- The "parent" of this promise in a promise chain. Required for
		-- cancellation propagation upstream.
		_parent = parent,

		-- Consumers are Promises that have chained onto this one.
		-- We track them for cancellation propagation downstream.
		_consumers = setmetatable({}, MODE_KEY_METATABLE),
	}

	if parent and parent._status == Promise.Status.Started then
		parent._consumers[self] = true
	end

	setmetatable(self, Promise)

	local function resolve(...)
		self:_resolve(...)
	end

	local function reject(...)
		self:_reject(...)
	end

	local function onCancel(cancellationHook)
		if cancellationHook then
			if self._status == Promise.Status.Cancelled then
				cancellationHook()
			else
				self._cancellationHook = cancellationHook
			end
		end

		return self._status == Promise.Status.Cancelled
	end

	coroutine.wrap(function()
		local ok, _, result = runExecutor(
			self._source,
			callback,
			resolve,
			reject,
			onCancel
		)

		if not ok then
			reject(result[1])
		end
	end)()

	return self
end

function Promise.new(executor)
	return Promise._new(debug.traceback(nil, 2), executor)
end

function Promise:__tostring()
	return string.format("Promise(%s)", self:getStatus())
end
-- Stores useful information about Luau errors.
export type Error = {
	type: string, -- replace with "Error" when Luau supports singleton types
	raw: string,
	message: string,
	trace: string
}
------------------------------------------------------------
--\Doors Update
------------------------------------------------------------
local DoorsFolder = ACS_Storage:FindFirstChild("Doors")
local CAS = game:GetService("ContextActionService")

local mDistance = 5
local Key = nil

function getNearest()
	local nearest = nil
	local minDistance = mDistance
	local Character = Player.Character or Player.CharacterAdded:Wait()
	
	for I,Door in pairs (DoorsFolder:GetChildren()) do
		if Door.Door:FindFirstChild("Knob") ~= nil then
			local distance = (Door.Door.Knob.Position - Character.Torso.Position).magnitude
		
			if distance < minDistance then
				nearest = Door
				minDistance = distance
			end
		end
	end
	--print(nearest)
	return nearest
end

function Interact(actionName, inputState, inputObj)
	if inputState ~= Enum.UserInputState.Begin then return end
	
	local nearestDoor = getNearest()
	local Character = Player.Character or Player.CharacterAdded:Wait()
	
	if nearestDoor == nil then return end
	
	if (nearestDoor.Door.Knob.Position - Character.Torso.Position).magnitude <= mDistance then
		if nearestDoor ~= nil then
			if nearestDoor:FindFirstChild("RequiresKey") then
				Key = nearestDoor.RequiresKey.Value
			else
				Key = nil
			end
			Evt.DoorEvent:FireServer(nearestDoor,1,Key)
		end
	end
end


function GetNearest(parts, maxDistance,Part)
	local closestPart
	local minDistance = maxDistance
    for _, partToFace in ipairs(parts) do
        local distance = (Part.Position - partToFace.Position).magnitude
        if distance < minDistance then
            closestPart = partToFace
            minDistance = distance
        end
   end
	return closestPart
end

CAS:BindAction("Interact", Interact, false, Enum.KeyCode.G)