Roblox/luau_corpus huggingface dataset:
--[=[
	Observes an instance's ancestry

	@param instance Instance
	@param className string
	@return Observable<Instance>
]=]
function RxInstanceUtils.observeFirstAncestorBrio(instance, className)
	assert(typeof(instance) == "Instance", "Bad instance")
	assert(type(className) == "string", "Bad className")

	return Observable.new(function(sub)
		local maid = Maid.new()

		local lastFound = nil
		local function handleAncestryChanged()
			local found = instance:FindFirstAncestorWhichIsA(className)

			if found then
				if found ~= lastFound then
					lastFound = found
					local brio = Brio.new(found)
					maid._current = brio
					sub:Fire(brio)
				end
			elseif lastFound then
				maid._current = nil
				lastFound = nil
			end
		end

		maid:GiveTask(instance.AncestryChanged:Connect(handleAncestryChanged))
		handleAncestryChanged()

		return maid
	end)
end
--[[Brakes]]
Tune.ABSEnabled		= false		-- Implements ABS
Tune.ABSThreshold	= 20		-- Slip speed allowed before ABS starts working (in SPS) 

Tune.FBrakeForce	= 1200		-- Front brake force
Tune.RBrakeForce	= 1600		-- Rear brake force
Tune.PBrakeForce	= 6000		-- Handbrake force

Tune.FLgcyBForce	= 15000		-- Front brake force [PGS OFF]
Tune.RLgcyBForce	= 10000		-- Rear brake force [PGS OFF]
Tune.LgcyPBForce	= 25000		-- Handbrake force [PGS OFF]
--// Connections
L_105_.OnClientEvent:connect(function(L_188_arg1, L_189_arg2, L_190_arg3, L_191_arg4, L_192_arg5, L_193_arg6, L_194_arg7)
	if L_188_arg1 and not L_15_ then
		MakeFakeArms()
		
		L_42_ = L_2_.PlayerGui.MainGui
		L_26_ = L_42_:WaitForChild('Others')
		L_27_ = L_26_:WaitForChild('Kill')
		L_28_ = L_42_:WaitForChild('GameGui'):WaitForChild('AmmoFrame')
		L_29_ = L_28_:WaitForChild('Ammo')
		L_30_ = L_28_:WaitForChild('AmmoBackground')
		L_31_ = L_28_:WaitForChild('MagCount')
		L_32_ = L_28_:WaitForChild('MagCountBackground')
		L_33_ = L_28_:WaitForChild('DistDisp')
		L_34_ = L_28_:WaitForChild('Title')
		L_35_ = L_28_:WaitForChild('Mode1')
		L_36_ = L_28_:WaitForChild('Mode2')
		L_37_ = L_28_:WaitForChild('Mode3')
		L_38_ = L_28_:WaitForChild('Mode4')
		L_39_ = L_28_:WaitForChild('Mode5')
		L_40_ = L_28_:WaitForChild('Stances')
		L_41_ = L_42_:WaitForChild('Shading')
		L_41_.Visible = false
		
		L_34_.Text = L_1_.Name
		UpdateAmmo()
		
		L_43_ = L_189_arg2
		L_44_ = L_190_arg3
		L_45_ = L_191_arg4
		L_46_ = L_192_arg5
		L_47_ = L_193_arg6
		L_48_ = L_194_arg7	
		L_49_ = L_59_.Bolt
		
		L_84_ = L_48_.C1
		L_85_ = L_48_.C0
		
		if L_1_:FindFirstChild('AimPart2') then
			L_54_ = L_1_:WaitForChild('AimPart2')
		end
		
		if L_1_:FindFirstChild('FirePart2') then
			L_57_ = L_1_.FirePart2
		end
		
		if L_24_.FirstPersonOnly then
			L_2_.CameraMode = Enum.CameraMode.LockFirstPerson
		end
		--uis.MouseIconEnabled = false
		L_5_.FieldOfView = 70
		L_15_ = true
	elseif L_15_ then
		if L_3_ and L_3_.Humanoid and L_3_.Humanoid.Health > 0 and L_9_ then
			Stand()
			Unlean()
		end	
		
		L_90_ = 0
		L_77_ = false
		L_78_ = false
		L_79_ = false
		L_61_ = false
		L_64_ = false
		L_63_ = false
		Shooting = false
		
		L_94_ = 70
		
		RemoveArmModel()
		
		L_42_:Destroy()	
		
		for L_195_forvar1, L_196_forvar2 in pairs(IgnoreList) do
			if L_196_forvar2 ~= L_3_ and L_196_forvar2 ~= L_5_ and L_196_forvar2 ~= L_98_ then
				table.remove(IgnoreList, L_195_forvar1)
			end
		end
		
		if L_3_:FindFirstChild('Right Arm') and L_3_:FindFirstChild('Left Arm') then
			L_3_['Right Arm'].LocalTransparencyModifier = 0
			L_3_['Left Arm'].LocalTransparencyModifier = 0
		end	

		L_75_ = false
		L_66_ = true
		
		L_2_.CameraMode = Enum.CameraMode.Classic
		L_104_.MouseIconEnabled = true		
		L_5_.FieldOfView = 70
		L_15_ = false
		L_104_.MouseDeltaSensitivity = L_52_
		L_15_ = false
	end
end)
-- Decompiled with the Synapse X Luau decompiler.

local v1 = {};
local v2 = require(game.ReplicatedStorage.Modules.Xeno);
local v3 = require(game.ReplicatedStorage.Modules.CameraShaker);
local l__TweenService__4 = game.TweenService;
local l__Debris__5 = game.Debris;
local u1 = require(game.ReplicatedStorage.Modules.Lightning);
local l__ReplicatedStorage__2 = game.ReplicatedStorage;
function v1.RunStompFx(p1, p2, p3, p4)
	task.delay(0, function()
		local v6 = u1.Bolt((CFrame.new(p2.CFrame.p) * CFrame.new(0, 250, 0) * CFrame.new(math.random(-1, 1), math.random(-1, 1), math.random(-1, 1))).Position, (p2.CFrame * CFrame.new(math.random(-2, 2), math.random(-1, 1), math.random(-1, 1))).Position, 10, 0.25, false);
		v6.PulseSpeed = 12;
		v6.PulseLength = 5;
		v6.MinRadius = 0;
		v6.MaxRadius = 5;
		v6.FadeLength = 0.1;
		v6.Thickness = 3;
		v6.MinTransparency = 0.25;
		v6.MaxTransparency = 0.3;
		v6.Color = Color3.fromRGB(251, 255, 16);
	end);
	local v7 = l__ReplicatedStorage__2.KillFX[p1].Stomp:Clone();
	v7.Parent = p2.Parent.UpperTorso and p2;
	v7:Play();
	game.Debris:AddItem(v7, 4);
	local v8 = l__ReplicatedStorage__2.KillFX[p1].HitPart:Clone();
	v8.Parent = workspace.Ignored.Animations;
	v8.CFrame = CFrame.new(p2.CFrame.Position);
	task.delay(0.25, function()
		for v9, v10 in pairs(v8.Attachment:GetChildren()) do
			v10.Enabled = false;
		end;
	end);
	task.delay(0.1, function()
		l__ReplicatedStorage__2.KillFX[p1].FireEffect:Clone().Parent = p2.Parent.UpperTorso;
		for v11, v12 in pairs(p2.Parent:GetDescendants()) do
			if v12:IsA("Basepart") and not v12:IsA("MeshPart") then
				v12.Color = Color3.fromRGB(0, 0, 0);
			elseif v12:IsA("Shirt") or v12:IsA("Pants") then
				v12.Color3 = Color3.fromRGB(0, 0, 0);
			elseif v12:IsA("Mesh") then
				v12.VertexColor = Color3.fromRGB(0, 0, 0);
			elseif v12:IsA("MeshPart") then
				v12.TextureID = "";
				v12.Color = Color3.fromRGB(0, 0, 0);
			end;
		end;
	end);
	game.Debris:AddItem(v8, 4);
	return nil;
end;
return v1;
-- loop to handle timed state transitions and tool animations
while Character.Parent ~= nil do
	local _, currentGameTime = wait(0.1)
	stepAnimate(currentGameTime)
end
 																																																																																																	--[[ 																																																																																																					]]																																																																																																																																																			
 																																																																																																	--[[ 																																																																																																					]]
--[=[
	Accepts an array of Promises and returns a new Promise that resolves with an array of in-place Statuses when all input Promises have settled. This is equivalent to mapping `promise:finally` over the array of Promises.

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

	return Promise.allSettled(promises)
	```

	@param promises {Promise<T>}
	@return Promise<{Status}>
]=]
function Promise.allSettled(promises)
	if type(promises) ~= "table" then
		error(string.format(ERROR_NON_LIST, "Promise.allSettled"), 2)
	end

	-- We need to check that each value is a promise here so that we can produce
	-- a proper error rather than a rejected promise with our error.
	for i, promise in pairs(promises) do
		if not Promise.is(promise) then
			error(string.format(ERROR_NON_PROMISE_IN_LIST, "Promise.allSettled", tostring(i)), 2)
		end
	end

	-- If there are no values then return an already resolved promise.
	if #promises == 0 then
		return Promise.resolve({})
	end

	return Promise._new(debug.traceback(nil, 2), function(resolve, _, onCancel)
		-- An array to contain our resolved values from the given promises.
		local fates = {}
		local newPromises = {}

		-- Keep a count of resolved promises because just checking the resolved
		-- values length wouldn't account for promises that resolve with nil.
		local finishedCount = 0

		-- Called when a single value is resolved and resolves if all are done.
		local function resolveOne(i, ...)
			finishedCount = finishedCount + 1

			fates[i] = ...

			if finishedCount >= #promises then
				resolve(fates)
			end
		end

		onCancel(function()
			for _, promise in ipairs(newPromises) do
				promise:cancel()
			end
		end)

		-- We can assume the values inside `promises` are all promises since we
		-- checked above.
		for i, promise in ipairs(promises) do
			newPromises[i] = promise:finally(function(...)
				resolveOne(i, ...)
			end)
		end
	end)
end
--Auto welding script (anchors so the tree doesnt fall apart)

for i,v in pairs(script.Parent:GetDescendants()) do
	if v.Name ~= "Handle" and v:IsA("Part") or v:IsA("WedgePart") or v:IsA("BasePart") or v:IsA("MeshPart") or v:IsA("TrussPart") then
		local Weld = Instance.new("WeldConstraint",v)
		Weld.Part0 = script.Parent.Handle
		Weld.Part1 = v
	end
end
-- << RETRIEVE FRAMEWORK >>
local main = require(game:GetService("ReplicatedStorage"):WaitForChild("HDAdminSetup")):GetMain(true)
main:Initialize("Client")
--Place me in StarterCharacterScripts located in StarterPlayer
local character = script.Parent
local timesby = 1 --Multiplyer
local DamageVelocity = 200 --How fast you go to take damage

local humanoid = script.Parent:WaitForChild("Humanoid")
local humanoidRP = script.Parent:WaitForChild("HumanoidRootPart")
local stateType = Enum.HumanoidStateType
local speed = 0
local fell = false
while true do
	wait()
	if humanoidRP.Velocity.Y < -DamageVelocity then
		speed = speed + timesby
		fell = false
		humanoid:SetStateEnabled(stateType.GettingUp, false)
		humanoid:ChangeState(stateType.FallingDown)
		humanoid.Parent.Head.RotVelocity = Vector3.new(0,10,20)
		
	end 		
	if humanoid.FloorMaterial ~= nil and humanoid.FloorMaterial ~= Enum.Material.Air and humanoid.FloorMaterial ~= Enum.Material.Rock and humanoid.FloorMaterial ~= Enum.Material.Water and fell then
		fell = false
		humanoid:ChangeState(stateType.FallingDown)
		humanoid.Health = humanoid.Health - speed
		speed = 0
		humanoid.Parent.UpperTorso.RotVelocity = Vector3.new(0,-10,20)
	elseif	humanoidRP.Velocity.Y > -DamageVelocity then
		wait()
		speed = 0
		humanoid:SetStateEnabled(stateType.GettingUp, true)
	end
end
--		for key,value in pairs(Objects) do
--			print("Name of object: ",key)
--			if sessionData[playerUserId][key] == nil then
--				print("Adding new version objects "..key)
--				sessionData[playerUserId][key] = false
--			end
--		end
--			for key,value in pairs(Objects) do
--				--print("Adding object "..key)
--				sessionData[playerUserId][key] = false
--			end	
			--Investigate
			--local purchaseHandlerNew = waitForTycoonsPurchaseHandlerNew()
			--local Objects = require(purchaseHandlerNew)
			--local Objects = require(tycoons[1]:WaitForChild("PurchaseHandlerNew"))
--"False" = Not Acceptable Keycard To Open. "True" = Acceptable Keycard To Open.--

local door = script.Parent
local bool = false
local CanOpen1 = true
local CanClose1 = false
local AccessDenied = script.Parent.AccessDenied
local AccessGranted = script.Parent.AccessGranted
local clearance = {
	["[SCP] Card-Omni"] = true, 
	["[SCP] Card-L5"] = false, 
	["[SCP] Card-L4"] = false,
	["[SCP] Card-L3"] = false,
	["[SCP] Card-L2"] = false,
	["[SCP] Card-L1"] = false
}
						
						--DO NOT EDIT PAST THIS LINE--
function openDoor()
	script.Parent.DoorOpen:play()
	for i = 3,(door.Size.z / 0.15) do
		wait()
		door.CFrame = door.CFrame - (door.CFrame.lookVector * 0.15)
	end
end

function closeDoor()
	script.Parent.DoorClose:play()
	for i = 3,(door.Size.z / 0.15) do
		wait()
		door.CFrame = door.CFrame + (door.CFrame.lookVector * 0.15)
	end
end

script.Parent.Parent.KeycardReader1.touched:connect(function(touch)
	if touch.Name == "Handle" and clearance[touch.Parent.Name] and CanOpen1 == true then
		
		CanOpen1 = false
		AccessGranted:Play()
		wait(0.75)
		openDoor()
		wait(1)
		CanClose1 = true
	elseif touch.Name == "Handle" and clearance[touch.Parent.Name] and CanClose1 == true then
		CanClose1 = false
		AccessGranted:Play()
		wait(0.75)
		closeDoor()
		wait(1)
		CanOpen1 = true
	elseif touch.Name == "Handle" and clearance[touch.Parent.Name] == false and not bool then
		bool = true
		AccessDenied:Play()
		wait(2)
		bool = false
	end
end)

script.Parent.Parent.KeycardReader2.touched:connect(function(touch)
	if touch.Name == "Handle" and clearance[touch.Parent.Name] and CanOpen1 == true then
		CanOpen1 = false
		AccessGranted:Play()
		wait(0.75)
		openDoor()
		wait(1)
		CanClose1 = true
	elseif touch.Name == "Handle" and clearance[touch.Parent.Name] and CanClose1 == true then
		CanClose1 = false
		AccessGranted:Play()
		wait(0.75)
		closeDoor()
		wait(1)
		CanOpen1 = true
	elseif touch.Name == "Handle" and clearance[touch.Parent.Name] == false and not bool then
		bool = true
		AccessDenied:Play()
		wait(2)
		bool = false
	end
end)
--------RIGHT DOOR --------
game.Workspace.doorright.l11.BrickColor = BrickColor.new(1013)
game.Workspace.doorright.l23.BrickColor = BrickColor.new(1013)
game.Workspace.doorright.l32.BrickColor = BrickColor.new(1013)
game.Workspace.doorright.l41.BrickColor = BrickColor.new(1013)
game.Workspace.doorright.l53.BrickColor = BrickColor.new(1013)
game.Workspace.doorright.l62.BrickColor = BrickColor.new(1013)
game.Workspace.doorright.l71.BrickColor = BrickColor.new(1013)

game.Workspace.doorright.l12.BrickColor = BrickColor.new(1023)
game.Workspace.doorright.l21.BrickColor = BrickColor.new(1023)
game.Workspace.doorright.l33.BrickColor = BrickColor.new(1023)
game.Workspace.doorright.l42.BrickColor = BrickColor.new(1023)
game.Workspace.doorright.l51.BrickColor = BrickColor.new(1023)
game.Workspace.doorright.l63.BrickColor = BrickColor.new(1023)
game.Workspace.doorright.l72.BrickColor = BrickColor.new(1023)

game.Workspace.doorright.l13.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l22.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l31.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l43.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l52.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l61.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l73.BrickColor = BrickColor.new(106)

game.Workspace.doorright.pillar.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.Lighting.flashcurrent.Value = "11"
-- How fast a player must fall down to avoid triggering the
-- anti-flight system. I recommend keeping this above 50
-- to curtail gliding exploits.
config.FlightHeatCooldownRequiredFallSpeed = 50
--end
----if TurnValues.TurnSignal2.Value == 2 then
	TurnValues.TurnSignal2.Value = 3
--print("player is closer than structure")
target = nearestPlayer
targetType = nearestPlayer.ClassName
lastLock = tick()
else
target = nearestBuilding
targetType = nearestBuilding.ClassName
lastLock = tick()
--edit the below function to execute code when this response is chosen OR this prompt is shown
--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)
	plrData.Money.Gold.Value = plrData.Money.Gold.Value - 12
	plrData.Character.Injuries.BrokenLeg.Value = false
end
--[[**
	ensures Lua primitive callback type

	@param value The value to check against

	@returns True iff the condition is satisfied, false otherwise
**--]]
t.callback = t.typeof("function")
t["function"] = t.callback
--[[
	ROBLOX TODO: add default generic param when possible
	original code:
	export const getMatchers = <
	  State extends MatcherState = MatcherState,
	>(): MatchersObject<State> => (global as any)[JEST_MATCHERS_OBJECT].matchers;
]]
local function getMatchers<State>(): MatchersObject<State>
	return _G[JEST_MATCHERS_OBJECT].matchers
end
--[=[
	@param predicate (player: Player, value: any) -> boolean
	@param value any -- Value to set for the clients (and to the predicate)
	Sets the value for specific clients that pass the `predicate`
	function test. This can be used to finely set the values
	based on more control logic (e.g. setting certain values
	per team).

	```lua
	-- Set the value of "NewValue" to players with a name longer than 10 characters:
	remoteProperty:SetFilter(function(player)
		return #player.Name > 10
	end, "NewValue")
	```
]=]
function RemoteProperty:SetFilter(predicate: (Player, any) -> boolean, value: any)
	for _,player in ipairs(Players:GetPlayers()) do
		if predicate(player, value) then
			self:SetFor(player, value)
		end
	end
end
------------------------------------

function onTouched(part)
	if part.Parent ~= nil then
	local h = part.Parent:findFirstChild("Humanoid")
		if h~=nil then
			local teleportfrom=script.Parent.Enabled.Value
			if teleportfrom~=0 then
				if h==humanoid then
				return
				end
				local teleportto=script.Parent.Parent:findFirstChild(modelname)
				if teleportto~=nil then
					local torso = h.Parent.Torso
					local location = {teleportto.Position}
					local i = 1

					local x = location[i].x
					local y = location[i].y
					local z = location[i].z
				
					x = x + math.random(-1, 1)
					z = z + math.random(-1, 1)
					y = y + math.random(2, 3)

					local cf = torso.CFrame
					local lx = 0
					local ly = y
					local lz = 0
					
					script.Parent.Enabled.Value=0
					teleportto.Enabled.Value=0
					torso.CFrame = CFrame.new(Vector3.new(x,y,z), Vector3.new(lx,ly,lz))
					wait(.1)
					script.Parent.Enabled.Value=1
					teleportto.Enabled.Value=1
				else
					print("Could not find teleporter!")
				end
			end
		end
	end
end

script.Parent.Touched:connect(onTouched)
-------------------------------------Gun info
ToolName="M4"

ClipSize=999999999999999999999999999999999999999999999999999999999999999999
ReloadTime=6
Firerate=.12
MinSpread=.1
MaxSpread=.1
SpreadRate=9
BaseDamage=22.5
automatic=true
burst=false
shot=false			--Semi Automatic
BarrlePos=Vector3.new(0.38,0.4,-3.4)
Cursors={"http://www.roblox.com/asset/?id=52812029"}
ReloadCursor="http://www.roblox.com/asset/?id=52812038"
-- This file was @generated by Tarmac. It is not intended for manual editing.
return {
	Calendar = "rbxassetid://8915045287",
	Caret = "rbxassetid://8915045496",
	ChevronLeft = "rbxassetid://8982072482",
	Close = "rbxassetid://8915045615",
	Clothing = "rbxassetid://8915045766",
	EmptyShop = "rbxassetid://9246449575",
	Eye = "rbxassetid://8915045943",
	Filter = "rbxassetid://8981626915",
	Gamepad = {
		ButtonA = "rbxassetid://8712691282",
		ButtonB = "rbxassetid://8712691429",
		ButtonL1 = "rbxassetid://8712691596",
		ButtonL2 = "rbxassetid://8712691753",
		ButtonR1 = "rbxassetid://8712691861",
		ButtonR2 = "rbxassetid://8712691936",
		ButtonX = "rbxassetid://8712692030",
		ButtonY = "rbxassetid://8712692150",
		DPadDown = "rbxassetid://8712692266",
		DPadLeft = "rbxassetid://8712692372",
		DPadRight = "rbxassetid://8712692480",
		DPadUp = "rbxassetid://8712692563",
	},
	Info = "rbxassetid://8915046089",
	KeyBacking = "rbxassetid://9186036717",
	RadioButtonInner = "rbxassetid://8971710558",
	RadioButtonOuter = "rbxassetid://8971710724",
	Robux = "rbxassetid://8915046254",
	Rotation = "rbxassetid://8915046440",
	ShoppingCart = "rbxassetid://9133862231",
	Sparkle = "rbxassetid://8915046721",
	Timer = "rbxassetid://8915046889",
}
--[=[
	@function removeValues
	@within Array

	@param array {T} -- The array to remove values from.
	@param ... T -- The values to remove.
	@return {T} -- The array with the values removed.

	Removes values from an array.

	```lua
	local array = { "a", "b", "c", "c", "d", "e" }

	local new = RemoveValues(array, "c", "d") -- { "a", "b", "e" }
	```
]=]
local function removeValues<T>(array: { T }, ...: T): { T }
	local valueSet = ToSet({ ... })
	local result = {}

	for _, value in ipairs(array) do
		if not valueSet[value] then
			table.insert(result, value)
		end
	end

	return result
end

return removeValues
-- Functions

local function __tostring(self)
	return self.ClassName
end

local function createClass(className, superClass)
	local class = {}
	class.__index = class
	class.__tostring = __tostring
	class.ClassName = className

	function class.new(...)
		local self = setmetatable({}, class)

		if self.__init then
			self:__init(...)
		end

		return self
	end

	if superClass then
		class.Super = superClass
		setmetatable(class, superClass)

		for methodName, shouldInherit in pairs(INHERITED) do
			if shouldInherit then
				class[methodName] = superClass[methodName]
			end
		end
	end

	return class
end
--[=[
	@param signal RBXScriptSignal
	@param fn (...: any) -> ()
	@return RBXScriptConnection
	Connects the function to the signal, adds the connection
	to the trove, and then returns the connection.

	This is shorthand for `trove:Add(signal:Connect(fn))`.

	```lua
	trove:Connect(workspace.ChildAdded, function(instance)
		print(instance.Name .. " added to workspace")
	end)
	```
]=]
function Trove:Connect(signal, fn)
	return self:Add(signal:Connect(fn))
end
-- Gradually regenerates the Kars' Health over time.

local REGEN_RATE = 1/70 -- Regenerate this fraction of MaxHealth per second.
local REGEN_STEP = 0.5 -- Wait this long between each regeneration step.
--// WIP
local function LoadPackage(package, folder, runNow)
	--// runNow - Run immediately after unpacking (default behavior is to just unpack (((only needed if loading after startup))))
	--// runNow currently not used (limitations) so all packages must be present at server startup
	local unpack; unpack = function(curFolder, unpackInto)
		if unpackInto then
			for i,obj in ipairs(curFolder:GetChildren()) do
				local clone = obj:Clone();
				if obj:IsA("Folder") then
					local realFolder = unpackInto:FindFirstChild(obj.Name);
					if not realFolder then
						clone.Parent = unpackInto;
					else
						unpack(obj, realFolder);
					end
				else
					clone.Parent = unpackInto;
				end
			end
		else
			warn("Missing parent to unpack into for ".. tostring(curFolder));
		end
	end;

	unpack(package, folder);
end;

local function CleanUp()
	--local env = getfenv(2)
	--local ran,ret = pcall(function() return env.script:GetFullName() end)
	warn("Beginning Adonis cleanup & shutdown process...")
	--warn("CleanUp called from "..tostring((ran and ret) or "Unknown"))
	--local loader = server.Core.ClientLoader
	server.Model.Name = "Adonis_Loader"
	server.Model.Parent = service.ServerScriptService
	server.Running = false

	pcall(service.Threads.StopAll)
	pcall(function()
		for i,v in pairs(RbxEvents) do
			print("Disconnecting event")
			v:Disconnect()
			table.remove(RbxEvents, i)
		end
	end)
	--loader.Archivable = false
	--loader.Disabled = true
	--loader:Destroy()
	if server.Core and server.Core.RemoteEvent then
		pcall(server.Core.DisconnectEvent);
	end

	--[[delay(0, function()
		for i,v in next,server do
			server[i] = nil; --// Try to break it to prevent any potential hanging issues; Not very graceful...
		end
	--end)--]]

	warn("Unloading complete")
end;

server = {
	Running = true;
	Modules = {};
	Pcall = Pcall;
	cPcall = cPcall;
	Routine = Routine;
	LogError = logError;
	ErrorLogs = ErrorLogs;
	ServerStartTime = os.time();
	CommandCache = {};
};

locals = {
	server = server;
	CodeName = "";
	Settings = server.Settings;
	HookedEvents = HookedEvents;
	ErrorLogs = ErrorLogs;
	logError = logError;
	origEnv = origEnv;
	Routine = Routine;
	Folder = Folder;
	GetEnv = GetEnv;
	cPcall = cPcall;
	Pcall = Pcall;
};

service = require(Folder.Shared.Service)(function(eType, msg, desc, ...)
	local extra = {...}
	if eType == "MethodError" then
		if server and server.Logs and server.Logs.AddLog then
			server.Logs.AddLog("Script", {
				Text = "Cached method doesn't match found method: "..tostring(extra[1]);
				Desc = "Method: "..tostring(extra[1])
			})
		end
	elseif eType == "ServerError" then
		--print("Server error")
		logError("Server", msg)
	elseif eType == "TaskError" then
		--print("Task error")
		logError("Task", msg)
	end
end, function(c, parent, tab)
	if not isModule(c) and c ~= server.Loader and c ~= server.Dropper and c ~= server.Runner and c ~= server.Model and c ~= script and c ~= Folder and parent == nil then
		tab.UnHook()
	end
end, ServiceSpecific, GetEnv(nil, {server = server}))
-- Returns the ancestor that contains a Humanoid, if it exists
local function FindCharacterAncestor(subject)
	if subject and subject ~= game.Workspace then
		local humanoid = subject:FindFirstChild('Humanoid')
		if humanoid then
			return subject, humanoid
		else
			return FindCharacterAncestor(subject.Parent)
		end
	end
	return nil
end