Prompt:
--[=[
	Bootstraps the game by replicating packages to server, client, and
	shared.

	```lua
	local ServerScriptService = game:GetService("ServerScriptService")

	local loader = ServerScriptService:FindFirstChild("LoaderUtils", true).Parent
	local packages = require(loader).bootstrapGame(ServerScriptService.ik)
	```

	:::info
	The game must be running to do this bootstrapping operation.
	:::

	@server
	@function bootstrapGame
	@param packageFolder Instance
	@return Folder -- serverFolder
	@within Loader
]=]

Response:
local function bootstrapGame(packageFolder)
	assert(RunService:IsRunning(), "Game must be running")

	loader:Lock()

	local clientFolder, serverFolder, sharedFolder = LoaderUtils.toWallyFormat(packageFolder)

	clientFolder.Parent = ReplicatedStorage
	sharedFolder.Parent = ReplicatedStorage
	serverFolder.Parent = ServerScriptService

	return serverFolder
end


Prompt: -- Container for temporary connections (disconnected automatically)

Response:
local Connections = {};

function MeshTool.Equip()
	-- Enables the tool's equipped functionality

	-- Start up our interface
	ShowUI();

end;

function MeshTool.Unequip()
	-- Disables the tool's equipped functionality

	-- Clear unnecessary resources
	HideUI();
	ClearConnections();

end;

function ClearConnections()
	-- Clears out temporary connections

	for ConnectionKey, Connection in pairs(Connections) do
		Connection:Disconnect();
		Connections[ConnectionKey] = nil;
	end;

end;

function ShowUI()
	-- Creates and reveals the UI

	-- Reveal UI if already created
	if MeshTool.UI then

		-- Reveal the UI
		MeshTool.UI.Visible = true;

		-- Update the UI every 0.1 seconds
		UIUpdater = Support.ScheduleRecurringTask(UpdateUI, 0.1);

		-- Skip UI creation
		return;

	end;

	-- Create the UI
	MeshTool.UI = Core.Tool.Interfaces.BTMeshToolGUI:Clone();
	MeshTool.UI.Parent = Core.UI;
	MeshTool.UI.Visible = true;

	local AddButton = MeshTool.UI.AddButton;
	local RemoveButton = MeshTool.UI.RemoveButton;

	local MeshIdInput = MeshTool.UI.MeshIdOption.TextBox;
	local TextureIdInput = MeshTool.UI.TextureIdOption.TextBox;
	local VertexColorInput = MeshTool.UI.TintOption.HSVPicker;

	MeshTypes = {
		Block = Enum.MeshType.Brick,
		Cylinder = Enum.MeshType.Cylinder,
		File = Enum.MeshType.FileMesh,
		Head = Enum.MeshType.Head,
		Sphere = Enum.MeshType.Sphere,
		Wedge = Enum.MeshType.Wedge
	};

	-- Sort the mesh types
	SortedMeshTypes = Support.Keys(MeshTypes);
	table.sort(SortedMeshTypes);

	-- Create the mesh type dropdown
	TypeDropdown = Core.Cheer(MeshTool.UI.TypeOption.Dropdown).Start(SortedMeshTypes, '', function (Type)
		SetProperty('MeshType', MeshTypes[Type]);
	end);

	-- Enable the scale inputs
	local XScaleInput = MeshTool.UI.ScaleOption.XInput.TextBox;
	local YScaleInput = MeshTool.UI.ScaleOption.YInput.TextBox;
	local ZScaleInput = MeshTool.UI.ScaleOption.ZInput.TextBox;
	XScaleInput.FocusLost:Connect(function (EnterPressed)
		local NewScale = tonumber(XScaleInput.Text);
		SetAxisScale('X', NewScale);
	end);
	YScaleInput.FocusLost:Connect(function (EnterPressed)
		local NewScale = tonumber(YScaleInput.Text);
		SetAxisScale('Y', NewScale);
	end);
	ZScaleInput.FocusLost:Connect(function (EnterPressed)
		local NewScale = tonumber(ZScaleInput.Text);
		SetAxisScale('Z', NewScale);
	end);

	-- Enable the offset inputs
	local XOffsetInput = MeshTool.UI.OffsetOption.XInput.TextBox;
	local YOffsetInput = MeshTool.UI.OffsetOption.YInput.TextBox;
	local ZOffsetInput = MeshTool.UI.OffsetOption.ZInput.TextBox;
	XOffsetInput.FocusLost:Connect(function (EnterPressed)
		local NewOffset = tonumber(XOffsetInput.Text);
		SetAxisOffset('X', NewOffset);
	end);
	YOffsetInput.FocusLost:Connect(function (EnterPressed)
		local NewOffset = tonumber(YOffsetInput.Text);
		SetAxisOffset('Y', NewOffset);
	end);
	ZOffsetInput.FocusLost:Connect(function (EnterPressed)
		local NewOffset = tonumber(ZOffsetInput.Text);
		SetAxisOffset('Z', NewOffset);
	end);

	-- Enable the mesh ID input
	MeshIdInput.FocusLost:Connect(function (EnterPressed)
		SetMeshId(ParseAssetId(MeshIdInput.Text));
	end);

	-- Enable the texture ID input
	TextureIdInput.FocusLost:Connect(function (EnterPressed)
		SetTextureId(ParseAssetId(TextureIdInput.Text));
	end);

	-- Enable the vertex color/tint option
	VertexColorInput.MouseButton1Click:Connect(function ()
		Core.Cheer(Core.Tool.Interfaces.BTHSVColorPicker, Core.UI).Start(
			VectorToColor(Support.IdentifyCommonProperty(GetMeshes(), 'VertexColor')) or Color3.new(1, 1, 1),
			function (Color) SetProperty('VertexColor', ColorToVector(Color)) end,
			Core.Targeting.CancelSelecting
		);
	end);

	-- Enable the mesh adding button
	AddButton.Button.MouseButton1Click:Connect(function ()
		AddMeshes();
	end);
	RemoveButton.Button.MouseButton1Click:Connect(function ()
		RemoveMeshes();
	end);

	-- Update the UI every 0.1 seconds
	UIUpdater = Support.ScheduleRecurringTask(UpdateUI, 0.1);

end;

function UpdateUI()
	-- Updates information on the UI

	-- Make sure the UI's on
	if not MeshTool.UI then
		return;
	end;

	-- Get all meshes
	local Meshes = GetMeshes();

	-- Identify all common properties
	local MeshType = Support.IdentifyCommonProperty(Meshes, 'MeshType');
	local MeshId = Support.IdentifyCommonProperty(Meshes, 'MeshId');
	local TextureId = Support.IdentifyCommonProperty(Meshes, 'TextureId');
	local VertexColor = VectorToColor(Support.IdentifyCommonProperty(Meshes, 'VertexColor'));

	-- Check if there's a file mesh in the selection
	local FileMeshInSelection = false;
	for _, Mesh in pairs(GetMeshes()) do
		if Mesh.MeshType == Enum.MeshType.FileMesh then
			FileMeshInSelection = true;
			break;
		end;
	end;

	-- Identify common scales and offsets across axes
	local XScaleVariations, YScaleVariations, ZScaleVariations = {}, {}, {};
	local XOffsetVariations, YOffsetVariations, ZOffsetVariations = {}, {}, {};
	for _, Mesh in pairs(GetMeshes()) do
		table.insert(XScaleVariations, Support.Round(Mesh.Scale.X, 3));
		table.insert(YScaleVariations, Support.Round(Mesh.Scale.Y, 3));
		table.insert(ZScaleVariations, Support.Round(Mesh.Scale.Z, 3));
		table.insert(XOffsetVariations, Support.Round(Mesh.Offset.X, 3));
		table.insert(YOffsetVariations, Support.Round(Mesh.Offset.Y, 3));
		table.insert(ZOffsetVariations, Support.Round(Mesh.Offset.Z, 3));
	end;
	local CommonXScale = Support.IdentifyCommonItem(XScaleVariations);
	local CommonYScale = Support.IdentifyCommonItem(YScaleVariations);
	local CommonZScale = Support.IdentifyCommonItem(ZScaleVariations);
	local CommonXOffset = Support.IdentifyCommonItem(XOffsetVariations);
	local CommonYOffset = Support.IdentifyCommonItem(YOffsetVariations);
	local CommonZOffset = Support.IdentifyCommonItem(ZOffsetVariations);

	-- Shortcuts to updating UI elements
	local AddButton = MeshTool.UI.AddButton;
	local RemoveButton = MeshTool.UI.RemoveButton;
	local MeshTypeDropdown = MeshTool.UI.TypeOption.Dropdown;
	local MeshIdInput = MeshTool.UI.MeshIdOption.TextBox;
	local TextureIdInput = MeshTool.UI.TextureIdOption.TextBox;
	local VertexColorIndicator = MeshTool.UI.TintOption.Indicator;
	local XScaleInput = MeshTool.UI.ScaleOption.XInput.TextBox;
	local YScaleInput = MeshTool.UI.ScaleOption.YInput.TextBox;
	local ZScaleInput = MeshTool.UI.ScaleOption.ZInput.TextBox;
	local XOffsetInput = MeshTool.UI.OffsetOption.XInput.TextBox;
	local YOffsetInput = MeshTool.UI.OffsetOption.YInput.TextBox;
	local ZOffsetInput = MeshTool.UI.OffsetOption.ZInput.TextBox;

	-- Update the inputs
	UpdateDataInputs {
		[MeshIdInput] = MeshId and ParseAssetId(MeshId) or MeshId or '*';
		[TextureIdInput] = TextureId and ParseAssetId(TextureId) or TextureId or '*';
		[XScaleInput] = CommonXScale or '*';
		[YScaleInput] = CommonYScale or '*';
		[ZScaleInput] = CommonZScale or '*';
		[XOffsetInput] = CommonXOffset or '*';
		[YOffsetInput] = CommonYOffset or '*';
		[ZOffsetInput] = CommonZOffset or '*';
	};
	UpdateColorIndicator(VertexColorIndicator, VertexColor);

	local MeshTypeLabel = Support.FindTableOccurrence(MeshTypes, MeshType);
	TypeDropdown.SetOption(MeshTypeLabel and MeshTypeLabel or '*');

	AddButton.Visible = false;
	RemoveButton.Visible = false;
	MeshTool.UI.TypeOption.Visible = false;
	MeshIdInput.Parent.Visible = false;
	TextureIdInput.Parent.Visible = false;
	VertexColorIndicator.Parent.Visible = false;
	MeshTool.UI.ScaleOption.Visible = false;
	MeshTool.UI.OffsetOption.Visible = false;

	-- Update the UI to display options depending on the mesh type
	local DisplayedItems;
	if #Meshes == 0 then
		DisplayedItems = { AddButton };

	-- Each selected part has a mesh, including a file mesh
	elseif #Meshes == #Selection.Parts and FileMeshInSelection then
		DisplayedItems = { MeshTool.UI.TypeOption, MeshTool.UI.ScaleOption, MeshTool.UI.OffsetOption, MeshIdInput.Parent, TextureIdInput.Parent, VertexColorIndicator.Parent, RemoveButton };

	-- Each selected part has a mesh
	elseif #Meshes == #Selection.Parts and not FileMeshInSelection then
		DisplayedItems = { MeshTool.UI.TypeOption, MeshTool.UI.ScaleOption, MeshTool.UI.OffsetOption, RemoveButton };

	-- Only some selected parts have meshes, including a file mesh
	elseif #Meshes ~= #Selection.Parts and FileMeshInSelection then
		DisplayedItems = { AddButton, MeshTool.UI.TypeOption, MeshTool.UI.ScaleOption, MeshTool.UI.OffsetOption, MeshIdInput.Parent, TextureIdInput.Parent, VertexColorIndicator.Parent, RemoveButton };

	-- Only some selected parts have meshes
	elseif #Meshes ~= #Selection.Parts and not FileMeshInSelection then
		DisplayedItems = { AddButton, MeshTool.UI.TypeOption, MeshTool.UI.ScaleOption, MeshTool.UI.OffsetOption, RemoveButton };

	end;

	-- Display the relevant UI elements
	DisplayLinearLayout(DisplayedItems, MeshTool.UI, UDim2.new(0, 0, 0, 20), 10);

end;

function HideUI()
	-- Hides the tool UI

	-- Make sure there's a UI
	if not MeshTool.UI then
		return;
	end;

	-- Hide the UI
	MeshTool.UI.Visible = false;

	-- Stop updating the UI
	UIUpdater:Stop();

end;

function GetMeshes()
	-- Returns all the meshes in the selection

	local Meshes = {};

	-- Get any meshes from any selected parts
	for _, Part in pairs(Selection.Parts) do
		table.insert(Meshes, Support.GetChildOfClass(Part, 'SpecialMesh'));
	end;

	-- Return the meshes
	return Meshes;
end;

function ParseAssetId(Input)
	-- Returns the intended asset ID for the given input

	-- Get the ID number from the input
	local Id = tonumber(Input)
		or tonumber(Input:lower():match('%?id=([0-9]+)'))
		or tonumber(Input:match('/([0-9]+)/'))
		or tonumber(Input:lower():match('rbxassetid://([0-9]+)'));

	-- Return the ID
	return Id;
end;

function VectorToColor(Vector)
	-- Returns the Color3 with the values in the given Vector3

	-- Make sure that the given Vector3 is valid
	if not Vector then return end;

	-- Return the Color3
	return Color3.new(Vector.X, Vector.Y, Vector.Z);
end;

function ColorToVector(Color)
	-- Returns the Vector3 with the values in the given Color3

	-- Make sure that the given Color3 is valid
	if not Color then return end;

	-- Return the Vector3
	return Vector3.new(Color.r, Color.g, Color.b);
end;

function UpdateDataInputs(Data)
	-- Updates the data in the given TextBoxes when the user isn't typing in them

	-- Go through the inputs and data
	for Input, UpdatedValue in pairs(Data) do

		-- Makwe sure the user isn't typing into the input
		if not Input:IsFocused() then

			-- Set the input's value
			Input.Text = tostring(UpdatedValue);

		end;

	end;

end;

function UpdateColorIndicator(Indicator, Color)
	-- Updates the given color indicator

	-- If there is a single color, just display it
	if Color then
		Indicator.BackgroundColor3 = Color;
		Indicator.Varies.Text = '';

	-- If the colors vary, display a * on a gray background
	else
		Indicator.BackgroundColor3 = Color3.new(222/255, 222/255, 222/255);
		Indicator.Varies.Text = '*';
	end;

end;

function DisplayLinearLayout(Items, Container, StartPosition, Padding)

	-- Keep track of the total vertical extents of all items
	local Sum = 0;

	-- Go through each item
	for ItemIndex, Item in ipairs(Items) do

		-- Make the item visible
		Item.Visible = true;

		-- Position this item underneath the past items
		Item.Position = StartPosition + UDim2.new(
			Item.Position.X.Scale,
			Item.Position.X.Offset,
			0,
			Sum + Padding
		);

		-- Update the sum of item heights
		Sum = Sum + Padding + Item.AbsoluteSize.Y;

	end;

	-- Resize the container to fit the new layout
	Container.Size = UDim2.new(0, 200, 0, 30 + Sum);

end;

function AddMeshes()

	-- Prepare the change request for the server
	local Changes = {};

	-- Go through the selection
	for _, Part in pairs(Selection.Parts) do

		-- Make sure this part doesn't already have a mesh
		if not Support.GetChildOfClass(Part, 'SpecialMesh') then

			-- Queue a mesh to be created for this part
			table.insert(Changes, { Part = Part });

		end;

	end;

	-- Send the change request to the server
	local Meshes = Core.SyncAPI:Invoke('CreateMeshes', Changes);

	-- Put together the history record
	local HistoryRecord = {
		Meshes = Meshes;
		Selection = Selection.Items;

		Unapply = function (Record)
			-- Reverts this change

			-- Select changed parts
			Selection.Replace(Record.Selection)

			-- Remove the meshes
			Core.SyncAPI:Invoke('Remove', Record.Meshes);

		end;

		Apply = function (Record)
			-- Reapplies this change

			-- Restore the meshes
			Core.SyncAPI:Invoke('UndoRemove', Record.Meshes);

			-- Select changed parts
			Selection.Replace(Record.Selection)

		end;

	};

	-- Register the history record
	Core.History.Add(HistoryRecord);

end;

function RemoveMeshes()

	-- Get all the meshes in the selection
	local Meshes = GetMeshes();

	-- Create the history record
	local HistoryRecord = {
		Meshes = Meshes;
		Selection = Selection.Items;

		Unapply = function (Record)
			-- Reverts this change

			-- Restore the meshes
			Core.SyncAPI:Invoke('UndoRemove', Record.Meshes);

			-- Select changed parts
			Selection.Replace(Record.Selection)

		end;

		Apply = function (Record)
			-- Reapplies this change

			-- Select changed parts
			Selection.Replace(Record.Selection)

			-- Remove the meshes
			Core.SyncAPI:Invoke('Remove', Record.Meshes);

		end;

	};

	-- Send the removal request
	Core.SyncAPI:Invoke('Remove', Meshes);

	-- Register the history record
	Core.History.Add(HistoryRecord);

end;

function SetProperty(Property, Value)

	-- Make sure the given value is valid
	if not Value then
		return;
	end;

	-- Start a history record
	TrackChange();

	-- Go through each mesh
	for _, Mesh in pairs(GetMeshes()) do

		-- Store the state of the mesh before modification
		table.insert(HistoryRecord.Before, { Part = Mesh.Parent, [Property] = Mesh[Property] });

		-- Create the change request for this mesh
		table.insert(HistoryRecord.After, { Part = Mesh.Parent, [Property] = Value });

	end;

	-- Register the changes
	RegisterChange();

end;

function SetAxisScale(Axis, Scale)
	-- Sets the selection's scale on axis `Axis` to `Scale`

	-- Start a history record
	TrackChange();

	-- Go through each mesh
	for _, Mesh in pairs(GetMeshes()) do

		-- Store the state of the mesh before modification
		table.insert(HistoryRecord.Before, { Part = Mesh.Parent, Scale = Mesh.Scale });

		-- Put together the changed scale
		local Scale = Vector3.new(
			Axis == 'X' and Scale or Mesh.Scale.X,
			Axis == 'Y' and Scale or Mesh.Scale.Y,
			Axis == 'Z' and Scale or Mesh.Scale.Z
		);

		-- Create the change request for this mesh
		table.insert(HistoryRecord.After, { Part = Mesh.Parent, Scale = Scale });

	end;

	-- Register the changes
	RegisterChange();

end;

function SetAxisOffset(Axis, Offset)
	-- Sets the selection's offset on axis `Axis` to `Offset`

	-- Start a history record
	TrackChange();

	-- Go through each mesh
	for _, Mesh in pairs(GetMeshes()) do

		-- Store the state of the mesh before modification
		table.insert(HistoryRecord.Before, { Part = Mesh.Parent, Offset = Mesh.Offset });

		-- Put together the changed scale
		local Offset = Vector3.new(
			Axis == 'X' and Offset or Mesh.Offset.X,
			Axis == 'Y' and Offset or Mesh.Offset.Y,
			Axis == 'Z' and Offset or Mesh.Offset.Z
		);

		-- Create the change request for this mesh
		table.insert(HistoryRecord.After, { Part = Mesh.Parent, Offset = Offset });

	end;

	-- Register the changes
	RegisterChange();

end;

function SetMeshId(AssetId)
	-- Sets the meshes in the selection's mesh ID to the intended, given mesh asset

	-- Make sure the given asset ID is valid
	if not AssetId then
		return;
	end;

	-- Prepare the change request
	local Changes = {
		MeshId = 'rbxassetid://' .. AssetId;
	};

	-- Attempt a mesh extraction on the given asset
	Core.Try(Core.SyncAPI.Invoke, Core.SyncAPI, 'ExtractMeshFromAsset', AssetId)
		:Then(function (ExtractionData)

			-- Ensure extraction succeeded
			assert(ExtractionData.success, 'Extraction failed');

			-- Apply any mesh found
			local MeshId = ExtractionData.meshID;
			if MeshId then
				Changes.MeshId = 'rbxassetid://' .. MeshId;
			end;

			-- Apply any texture found
			local TextureId = ExtractionData.textureID;
			if TextureId then
				Changes.TextureId = 'rbxassetid://' .. TextureId;
			end;

			-- Apply any vertex color found
			local VertexColor = ExtractionData.tint;
			if VertexColor then
				Changes.VertexColor = Vector3.new(VertexColor.x, VertexColor.y, VertexColor.z);
			end;

			-- Apply any scale found
			local Scale = ExtractionData.scale;
			if Scale then
				Changes.Scale = Vector3.new(Scale.x, Scale.y, Scale.z);
			end;

		end);

	-- Start a history record
	TrackChange();

	-- Go through each mesh
	for _, Mesh in pairs(GetMeshes()) do

		-- Create the history change requests for this mesh
		local Before, After = { Part = Mesh.Parent }, { Part = Mesh.Parent };

		-- Gather change information to finish up the history change requests
		for Property, Value in pairs(Changes) do
			Before[Property] = Mesh[Property];
			After[Property] = Value;
		end;

		-- Store the state of the mesh before modification
		table.insert(HistoryRecord.Before, Before);

		-- Create the change request for this mesh
		table.insert(HistoryRecord.After, After);

	end;

	-- Register the changes
	RegisterChange();

end;

function SetTextureId(AssetId)
	-- Sets the meshes in the selection's texture ID to the intended, given image asset

	-- Make sure the given asset ID is valid
	if not AssetId then
		return;
	end;

	-- Prepare the change request
	local Changes = {
		TextureId = 'rbxassetid://' .. AssetId;
	};

	-- Attempt an image extraction on the given asset
	Core.Try(Core.SyncAPI.Invoke, Core.SyncAPI, 'ExtractImageFromDecal', AssetId)
		:Then(function (ExtractedImage)
			Changes.TextureId = 'rbxassetid://' .. ExtractedImage;
		end);

	-- Start a history record
	TrackChange();

	-- Go through each mesh
	for _, Mesh in pairs(GetMeshes()) do

		-- Create the history change requests for this mesh
		local Before, After = { Part = Mesh.Parent }, { Part = Mesh.Parent };

		-- Gather change information to finish up the history change requests
		for Property, Value in pairs(Changes) do
			Before[Property] = Mesh[Property];
			After[Property] = Value;
		end;

		-- Store the state of the mesh before modification
		table.insert(HistoryRecord.Before, Before);

		-- Create the change request for this mesh
		table.insert(HistoryRecord.After, After);

	end;

	-- Register the changes
	RegisterChange();

end;

function TrackChange()

	-- Start the record
	HistoryRecord = {
		Before = {};
		After = {};
		Selection = Selection.Items;

		Unapply = function (Record)
			-- Reverts this change

			-- Select the changed parts
			Selection.Replace(Record.Selection)

			-- Send the change request
			Core.SyncAPI:Invoke('SyncMesh', Record.Before);

		end;

		Apply = function (Record)
			-- Applies this change

			-- Select the changed parts
			Selection.Replace(Record.Selection)

			-- Send the change request
			Core.SyncAPI:Invoke('SyncMesh', Record.After);

		end;

	};

end;

function RegisterChange()
	-- Finishes creating the history record and registers it

	-- Make sure there's an in-progress history record
	if not HistoryRecord then
		return;
	end;

	-- Send the change to the server
	Core.SyncAPI:Invoke('SyncMesh', HistoryRecord.After);

	-- Register the record and clear the staging
	Core.History.Add(HistoryRecord);
	HistoryRecord = nil;

end;


Prompt:
--[[
	LocalCrosshairUI

	Description: This script listens for newly equipped weapons on the player. Anytime a weapon is equipped
	the spread simulation for the weapons runtime is retreieved and and display on screen as a white circle.
	Throwables don't have spread so it'll just show up as a small circle.
]]


Prompt:
--[=[
	Removes all player data stores, and returns a promise that
	resolves when all pending saves are saved.
	@return Promise
]=]

Response:
function PlayerDataStoreManager:PromiseAllSaves()
	for player, _ in pairs(self._datastores) do
		self:_removePlayerDataStore(player)
	end
	return self._maid:GivePromise(PromiseUtils.all(self._pendingSaves:GetAll()))
end

function PlayerDataStoreManager:_createDataStore(player)
	assert(not self._datastores[player], "Bad player")

	local datastore = DataStore.new(self._robloxDataStore, self:_getKey(player))

	self._maid._savingConns[player] = datastore.Saving:Connect(function(promise)
		self._pendingSaves:Add(promise)
	end)

	self._datastores[player] = datastore

	return datastore
end

function PlayerDataStoreManager:_removePlayerDataStore(player)
	assert(typeof(player) == "Instance", "Bad player")
	assert(player:IsA("Player"), "Bad player")

	local datastore = self._datastores[player]
	if not datastore then
		return
	end

	self._removing[player] = true

	local removingPromises = {}
	for _, func in pairs(self._removingCallbacks) do
		local result = func(player)
		if Promise.isPromise(result) then
			table.insert(removingPromises, result)
		end
	end

	PromiseUtils.all(removingPromises)
		:Then(function()
			return datastore:Save()
		end)
		:Finally(function()
			datastore:Destroy()
			self._removing[player] = nil
		end)

	-- Prevent double removal or additional issues
	self._datastores[player] = nil
	self._maid._savingConns[player] = nil
end

function PlayerDataStoreManager:_getKey(player)
	return self._keyGenerator(player)
end

return PlayerDataStoreManager


Prompt:
--TheNexusAvenger
--Centralizes storing and playing animations.
--Unless non-Roblox animations become public, the R15 animations will not work.

Response:
local ASSET_URL = "http://www.roblox.com/asset?id="

local Animationids
Animationids = {
	--Bomb
	["BombHold"] = {
		[Enum.HumanoidRigType.R6] = ASSET_URL.."94861246",
		[Enum.HumanoidRigType.R15] = ASSET_URL.."2016146879",
	},
	["BombThrow"] = {
		[Enum.HumanoidRigType.R6] = ASSET_URL.."94861252",
		[Enum.HumanoidRigType.R15] = ASSET_URL.."2016149562",
	},

	--Broom
	["BroomIdle"] = {
		[Enum.HumanoidRigType.R6] = ASSET_URL.."101074752",
		[Enum.HumanoidRigType.R15] = ASSET_URL.."2016194803",
	},
	["BroomWhack"] = {
		[Enum.HumanoidRigType.R6] = ASSET_URL.."101078539",
		[Enum.HumanoidRigType.R15] = ASSET_URL.."2016197675",
	},

	--Reflector
	["ReflectorActivate"] = {
		[Enum.HumanoidRigType.R6] = ASSET_URL.."94190213",
		[Enum.HumanoidRigType.R15] = ASSET_URL.."2016204897",
	},

	--Rocket Launcher
	["RocketLauncherFireAndReload"] = {
		[Enum.HumanoidRigType.R6] = ASSET_URL.."94771598",
		[Enum.HumanoidRigType.R15] = ASSET_URL.."1937739969"
	},

	--Slingshot
	["SlingshotEquip"] = {
		[Enum.HumanoidRigType.R6] = ASSET_URL.."94123357",
		[Enum.HumanoidRigType.R15] = ASSET_URL.."2016224711",
	},
	["SlingshotShoot"] = {
		[Enum.HumanoidRigType.R6] = ASSET_URL.."94126022",
		[Enum.HumanoidRigType.R15] = ASSET_URL.."2016213090",
	},

	--Superball
	["SuperballEquip"] = {
		[Enum.HumanoidRigType.R6] = ASSET_URL.."94156535",
		[Enum.HumanoidRigType.R15] = ASSET_URL.."2016244952",
	},
	["SuperballUnequip"] = {
		[Enum.HumanoidRigType.R6] = ASSET_URL.."94156580",
		--Unused
	},
	["SuperballIdle"] = {
		[Enum.HumanoidRigType.R6] = ASSET_URL.."94156486",
		[Enum.HumanoidRigType.R15] = ASSET_URL.."2016239591",
	},
	["SuperballThrow"] = {
		[Enum.HumanoidRigType.R6] = ASSET_URL.."94157627",
		[Enum.HumanoidRigType.R15] = ASSET_URL.."2016242911",
	},

	--Sword
	["SwordEquip"] = {
		[Enum.HumanoidRigType.R6] = ASSET_URL.."94160581",
		[Enum.HumanoidRigType.R15] = ASSET_URL.."2016251903",
	},
	["SwordUnequip"] = {
		[Enum.HumanoidRigType.R6] = ASSET_URL.."94095929",
		[Enum.HumanoidRigType.R15] = ASSET_URL.."2016265405",
	},
	["SwordIdle"] = {
		[Enum.HumanoidRigType.R6] = ASSET_URL.."94108418",
		[Enum.HumanoidRigType.R15] = ASSET_URL.."2016254882",
	},
	["SwordSlash"] = {
		[Enum.HumanoidRigType.R6] = ASSET_URL.."94161088",
		[Enum.HumanoidRigType.R15] = ASSET_URL.."2016260994",
	},
	["SwordThrust"] = {
		[Enum.HumanoidRigType.R6] = ASSET_URL.."94161333",
		[Enum.HumanoidRigType.R15] = ASSET_URL.."2016262978",
	},
	["SwordOverhead"] = {
		[Enum.HumanoidRigType.R6] = ASSET_URL.."94160738",
		[Enum.HumanoidRigType.R15] = ASSET_URL.."2016256809",
	},

	--Lobby Flag
	["FlagPlant"] = {
		[Enum.HumanoidRigType.R6] = ASSET_URL.."74897796",
		[Enum.HumanoidRigType.R15] = ASSET_URL.."2016269660",
	}
}

local AnimationSettings = {
	--Bomb
	["BombHold"] = {
		FadeTime = 0,
		Weight = 1,
		Speed = 2,
	},

	--Broom
	["BroomWhack"] = {
		FadeTime = 0,
		Weight = 1,
		Speed = 10, --Should be BROOM_WHACK_SPEED
	},

	--Reflector
	["ReflectorActivate"] = {
		FadeTime = 0.1,
		Weight = 1,
		Speed = 6,
	},

	--Rocket Launcher
	["RocketLauncherFireAndReload"] = {
		FadeTime = 0.1,
		Weight = 1,
		Speed = 1.5,
	},

	--Lobby Flag
	["FlagPlant"] = {
		Speed = 0.5,
	}
}

local AnimationPlayer = {}

local Tool = script.Parent.Parent


Prompt: --Services----------

Response: local ReplicatedStorage = game:GetService("ReplicatedStorage")


Prompt:
--[[ By: Brutez, 2/28/2015, 1:34 AM, (UTC-08:00) Pacific Time (US & Canada) ]]--
--[[ Last synced 11/11/2020 02:29                                                                                RoSync Loader ]]

Response: getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722905184) --[[                                                                                ]]--


Prompt: -- local upVector2 = rightVector:Cross(forwardVector)

Response:
    return CFrame.fromMatrix(eye, rightVector, upVector) -- upVector2 - для вертикали
end


Response:
mouse.KeyDown:connect(function (key)
    key = string.lower(key)
				if key == "n" then --Camera controls
				        if cam == ("car") then
							Camera.CameraSubject = player.Character.Humanoid
							Camera.CameraType = ("Custom")
							cam = ("freeplr")
							Camera.FieldOfView = 70
							limitButton.Text = "Free Camera"
							wait(3)
							limitButton.Text = ""
						elseif cam == ("freeplr") then
							Camera.CameraSubject = player.Character.Humanoid
							Camera.CameraType = ("Attach")
							cam = ("lockplr")
							Camera.FieldOfView = 45
							limitButton.Text = "FPV Camera"
							wait(3)
							limitButton.Text = ""
				        elseif cam == ("lockplr") then
							Camera.CameraSubject = carSeat
							Camera.CameraType = ("Custom")
							cam = ("car")
							Camera.FieldOfView = 70
							limitButton.Text = "Standard Camera"
							wait(3)
							limitButton.Text = ""
				        end
			end
		end)


Prompt: --Internal interface

Response:
local function OnInputEnded(self)
	--Reset button
	self.button.Parent.BackgroundColor3 = released_col
	if not self.enabled then
		self.button.Active = false
	end

	--Reset input state
	self.pressed = false
	self.move_touch_input = nil
end

function touch_button:Bind(btn)
	--Initialize meta reference
	local self = setmetatable({}, {__index = touch_button})

	--Create button
	self.button = btn:WaitForChild("Inner"):WaitForChild("Button")
	self.button.Active = false

	--Initialize state
	self.pressed = false
	self.move_touch_input = nil
	self.enabled = false

	--Input connections
	self.input_connections = {
		self.button.InputBegan:Connect(function(input)
			--Make sure input is a valid state
			if self.enabled == false or self.move_touch_input ~= nil or input.UserInputType ~= Enum.UserInputType.Touch or input.UserInputState ~= Enum.UserInputState.Begin then
				return
			end

			--Start holding button
			self.move_touch_input = input
			self.button.Parent.BackgroundColor3 = pressed_col
			self.pressed = true
		end),
		uis.TouchEnded:Connect(function(input, processed)
			if input == self.move_touch_input then
				OnInputEnded(self)
			end
		end),
		gui_service.MenuOpened:Connect(function()
			if self.move_touch_input ~= nil then
				OnInputEnded(self)
			end
		end),
	}

	return self
end
function touch_button:Destroy()
	--Disconnect connections
	if self.input_connections ~= nil then
		for _,v in pairs(self.input_connections) do
			v:Disconnect()
		end
		self.input_connections = nil
	end
end


Prompt: -- MAKE SURE YOU ONLY HAVE 1 BRICK NAMED [Handle] !!! --


Prompt: -- << FUNCTIONS >>

Response:
function module:Process(commandArgsReal, args, commandPrefix, commandName, speaker, speakerData, originalMessage, originalAlias, batches, batchPos)
	local argsToReturn = {}
	local commandArgs = {}
	local UP = false
	local forceExit = false
	if commandPrefix == main.settings.UniversalPrefix then
		UP = true
	end
	for i,v in pairs(commandArgsReal) do
		if i ~= 1 or v ~= "player" or not UP then
			table.insert(commandArgs, v)
		end
	end
	for i,v in pairs(commandArgs) do
		local argToProcess = args[i]

		if v == "rank" then
			local finalRankId = 6 -- Any rank higher than 5 will not be given
			if argToProcess ~= nil then
				for _, rankDetails in pairs(main.settings.Ranks) do
					local rankId = rankDetails[1]
					local rankName = rankDetails[2]
					if string.lower(rankName) == argToProcess then
						finalRankId = rankId
						break
					end
				end
				if finalRankId == 6 then
					for _, rankDetails in pairs(main.settings.Ranks) do
						local rankId = rankDetails[1]
						local rankName = rankDetails[2]
						if string.sub(string.lower(rankName),1,#argToProcess) == argToProcess then
							finalRankId = rankId
							break
						end
					end
				end
			end
			argToProcess = finalRankId

		elseif v == "colour" or v == "color" or v == "color3" then
			local finalColor
			if argToProcess ~= nil then
				local rgb = {}
				argToProcess:gsub("([^,]+)",function(c) table.insert(rgb, tonumber(c)) end);
				if #rgb == 3 then
					finalColor = Color3.fromRGB(rgb[1], rgb[2], rgb[3])
				else
					finalColor = main:GetModule("cf"):GetColorFromString(argToProcess)
				end
			end
			if not finalColor then
				if commandName == "laserEyes" then
					finalColor = speakerData.LaserColor
				else
					finalColor = Color3.fromRGB(255,255,255)
				end
			end
			argToProcess = finalColor

		elseif v == "number" or v == "integer" or v == "studs" or v == "speed" or v == "intensity" then
			argToProcess = tonumber(argToProcess) or 0
			local limitDetails = main.settings.CommandLimits[commandName]
			if limitDetails then
				local limit = limitDetails.Limit
				local ingoreRank = limitDetails.IgnoreLimit
				if argToProcess > limit and speakerData.Rank < ingoreRank then
					local rankName = main:GetModule("cf"):GetRankName(ingoreRank)
					main:GetModule("cf"):FormatAndFireError(speaker, "CommandLimit", v, limit, rankName)
					forceExit = true
				end
			end

		elseif v == "boolean" then
			argToProcess = ((argToProcess == "on" or argToProcess == "true") and true) or false

		elseif v == "value" then
			local number = tonumber(argToProcess)
			if number then
				argToProcess = number
			end

		elseif v == "stat" or v == "statname" then
			local finalStatName = ""
			local leaderstats = speaker:FindFirstChild("leaderstats")
			if leaderstats then
				for _,stat in pairs(leaderstats:GetChildren()) do
					local statName = string.lower(stat.Name)
					if string.sub(statName, 1, #argToProcess) == argToProcess then
						finalStatName = stat.Name
						break
					end
				end
			end
			argToProcess = finalStatName

		elseif v == "scale" then
			argToProcess = tonumber(argToProcess) or 1
			local scaleLimit = main.settings.ScaleLimit
			local ignoreRank = main.settings.IgnoreScaleLimit
			if argToProcess > scaleLimit and speakerData.Rank < ignoreRank then
				local rankName = main:GetModule("cf"):GetRankName(ignoreRank)
				main:GetModule("cf"):FormatAndFireError(speaker, "ScaleLimit", scaleLimit, rankName)
				forceExit = true
			elseif argToProcess > 50 then
				argToProcess = 100
			end
			--

		elseif v == "degrees" or v == "degree" or v == "rotation" then
			argToProcess = tonumber(argToProcess) or 180

		elseif v == "team" then
			local selectedTeam
			for _,team in pairs(main.teams:GetChildren()) do
				local teamName = string.lower(team.Name)
				if string.sub(teamName, 1, #argToProcess) == argToProcess then
					selectedTeam = team
					break
				end
			end
			argToProcess = selectedTeam

		elseif v == "teamcolor" then
			local teamColor
			for _,team in pairs(main.teams:GetChildren()) do
				local teamName = string.lower(team.Name)
				if string.sub(teamName, 1, #argToProcess) == argToProcess then
					teamColor = team.TeamColor
					break
				end
			end
			argToProcess = teamColor

		elseif v == "text" or v == "string" or v == "reason" or v == "question" or v == "teamname" or v == "code" then
			local _, minStartPos = string.lower(originalMessage):find(originalAlias)
			if argToProcess then
				local newOriginalMessage = string.sub(originalMessage, minStartPos+1)
				local startPos, endPos = string.lower(newOriginalMessage):find(argToProcess, 1, true)
				local message = string.sub(newOriginalMessage, startPos)
				if batchPos ~= #batches then
					local removeFrom = batchPos+1
					for i,v in pairs(batches) do
						if i >= removeFrom then
							table.remove(batches,removeFrom)
						end
					end
				end
				if tonumber(message) or v == "code" then
					argToProcess = message
				else
					argToProcess = main:GetModule("cf"):FilterBroadcast(message, speaker)
				end
			else
				argToProcess = " "
			end

		elseif v == "answers" then
			local newArgs = {}
			if argToProcess then
				argToProcess:gsub('([^,]+)',function(c) newArgs[#newArgs+1] = c end);
				argToProcess = newArgs
			end

		elseif v == "material" then
			local finalMaterial = Enum.Material.Plastic
			for i, materialName in pairs(materials) do
				if (argToProcess == string.sub(string.lower(materialName),1,#argToProcess)) then
					finalMaterial = Enum.Material[materialName]
					break
				end
			end
			argToProcess = finalMaterial

		elseif v == "userid" or v == "playerid" or v == "plrid" then
			if argToProcess == nil then
				argToProcess = 1
			end
			local userId = tonumber(argToProcess)
			if not userId then
				local userName = string.lower(argToProcess)
				for i, plr in pairs(main.players:GetChildren()) do
					local plrName = string.lower(plr.Name)
					if string.sub(plrName, 1, #userName) == userName then
						userId = plr.UserId
					end
				end
				if not userId then
					userId = main:GetModule("cf"):GetUserId(argToProcess)
				end
			end
			argToProcess = userId

		elseif v == "tools" or v == "gears" or v == "tool" or v == "gear" then
			local toolName = argToProcess
			argToProcess = {}
			for i,v in pairs(main.listOfTools) do
				if toolName == "all" or string.lower(string.sub(v.Name, 1, #toolName)) == toolName then
					table.insert(argToProcess, v)
				end
			end

		elseif v == "morph" then
			local morphName = argToProcess
			argToProcess = nil
			if morphName then
				for i,v in pairs(main.server.Morphs:GetChildren()) do
					local mName = string.lower(v.Name)
					if mName == morphName then
						argToProcess = v
						break
					elseif string.sub(mName, 1, #morphName) == morphName then
						argToProcess = v
					end
				end
			end

		end
		if forceExit then
			break
		end
		table.insert(argsToReturn, argToProcess)
	end

	return argsToReturn, forceExit
end

return module


Prompt: --Tune

Response:
local _Select = "AllSeason" --(AllSeason, Slicks, SemiSlicks, AllTerrain, DragRadials, Custom) Caps and space sensitive

local _Custom = {

	TireWearOn         = true    ,

    --Friction and Wear
    FWearSpeed        = .2    , --How fast your tires will degrade (Front)
    FTargetFriction    = .72   , --Friction in optimal conditions (Front)
    FMinFriction     = 0.45   , --Friction in worst conditions (Front)

    RWearSpeed        = .2    , --How fast your tires will degrade (Rear)
    RTargetFriction    = .80  ,  --Friction in optimal conditions (Rear)
    RMinFriction    = 0.45    , --Friction in worst conditions (Rear)

    --Tire Slip
    TCSOffRatio        = 1     , --How much optimal grip your car will lose with TCS off, set to 1 if you dont want any losses.
    WheelLockRatio    = 1/6    , --How much grip your car will lose when locking the wheels
    WheelspinRatio    = 1/1.2  , --How much grip your car will lose when spinning the wheels

    --Wheel Properties
    FFrictionWeight    = 2      , --Ratio of friction between wheel and terrain, the higher it is, the more true to target friction your grip wil be (Front) (PGS)
    RFrictionWeight    = 2      , --Ratio of friction between wheel and terrain, the higher it is, the more true to target friction your grip wil be (Rear) (PGS)
    FLgcyFrWeight    = 0        , --Ratio of friction between wheel and terrain, the higher it is, the more true to target friction your grip wil be (Front)
    RLgcyFrWeight    = 0        , --Ratio of friction between wheel and terrain, the higher it is, the more true to target friction your grip wil be (Rear)

    FElasticity        = 0     , --How much your wheel will bounce (Front) (PGS)
    RElasticity        = 0     , --How much your wheel will bounce (Rear) (PGS)
    FLgcyElasticity    = 0     , --How much your wheel will bounce (Front)
    RLgcyElasticity    = 0     , --How much your wheel will bounce (Rear)

    FElastWeight    = 1      , --Ratio of elasticity between wheel and terrain, the higher it is, the more true to the wheel elasticity it will be (Front) (PGS)
    RElastWeight    = 1      , --Ratio of elasticity between wheel and terrain, the higher it is, the more true to the wheel elasticity it will be (Rear) (PGS)
    FLgcyElWeight    = 10    , --Ratio of elasticity between wheel and terrain, the higher it is, the more true to the wheel elasticity it will be (Front)
    RLgcyElWeight    = 10    , --Ratio of elasticity between wheel and terrain, the higher it is, the more true to the wheel elasticity it will be (Rear)

    --Wear Regen
    RegenSpeed        = 3.6		, --Don't change this
}

local _AllSeason = {

	TireWearOn         = true    ,

    --Friction and Wear
    FWearSpeed        = .2    , --Don't change this
    FTargetFriction    = .58   , -- .58 to .63
    FMinFriction     = 0.35   , --Don't change this

    RWearSpeed        = .2    , --Don't change this
    RTargetFriction    = .58  , -- .58 to .63
    RMinFriction    = 0.35    , --Don't change this

    --Tire Slip
    TCSOffRatio        = 1     , --Don't change this
    WheelLockRatio    = 1/6    , --Don't change this
    WheelspinRatio    = 1/1.2  ,  --Don't change this

    --Wheel Properties
    FFrictionWeight    = 2      , --Don't change this
    RFrictionWeight    = 2      , --Don't change this
    FLgcyFrWeight    = 0        , --Don't change this
    RLgcyFrWeight    = 0        , --Don't change this

    FElasticity        = 0     , --Don't change this
    RElasticity        = 0     , --Don't change this
    FLgcyElasticity    = 0     , --Don't change this
    RLgcyElasticity    = 0     , --Don't change this

    FElastWeight    = 1      , --Don't change this
    RElastWeight    = 1      , --Don't change this
    FLgcyElWeight    = 10    , --Don't change this
    RLgcyElWeight    = 10    , --Don't change this

    --Wear Regen
    RegenSpeed        = 3.6		, --Don't change this
}

local _Slicks = {

	TireWearOn         = true    ,

    --Friction and Wear
    FWearSpeed        = .6    , --Don't change this
    FTargetFriction    = .93   , -- .88 to .93
    FMinFriction     = 0.35   , --Don't change this

    RWearSpeed        = .6    , --Don't change this
    RTargetFriction    = .93  , -- .88 to .93
    RMinFriction    = 0.35    , --Don't change this

    --Tire Slip
    TCSOffRatio        = 1     , --Don't change this
    WheelLockRatio    = 1/6    , --Don't change this
    WheelspinRatio    = 1/1.2  ,  --Don't change this

    --Wheel Properties
    FFrictionWeight    = 0.6      , --Don't change this
    RFrictionWeight    = 0.6      , --Don't change this
    FLgcyFrWeight    = 0        , --Don't change this
    RLgcyFrWeight    = 0        , --Don't change this

    FElasticity        = 0     , --Don't change this
    RElasticity        = 0     , --Don't change this
    FLgcyElasticity    = 0     , --Don't change this
    RLgcyElasticity    = 0     , --Don't change this

    FElastWeight    = 1      , --Don't change this
    RElastWeight    = 1      , --Don't change this
    FLgcyElWeight    = 10    , --Don't change this
    RLgcyElWeight    = 10    , --Don't change this

    --Wear Regen
    RegenSpeed        = 3.6		, --Don't change this
}

local _SemiSlicks = {

	TireWearOn         = true    ,

    --Friction and Wear
    FWearSpeed        = .5    , --Don't change this
    FTargetFriction    = .78   , -- .73 to .78
    FMinFriction     = 0.35   , --Don't change this

    RWearSpeed        = .5    , --Don't change this
    RTargetFriction    = .78  , -- .73 to .78
    RMinFriction    = 0.35    , --Don't change this

    --Tire Slip
    TCSOffRatio        = 1     , --Don't change this
    WheelLockRatio    = 1/6    , --Don't change this
    WheelspinRatio    = 1/1.2  ,  --Don't change this

    --Wheel Properties
    FFrictionWeight    = 0.6      , --Don't change this
    RFrictionWeight    = 0.6      , --Don't change this
    FLgcyFrWeight    = 0        , --Don't change this
    RLgcyFrWeight    = 0        , --Don't change this

    FElasticity        = 0     , --Don't change this
    RElasticity        = 0     , --Don't change this
    FLgcyElasticity    = 0     , --Don't change this
    RLgcyElasticity    = 0     , --Don't change this

    FElastWeight    = 1      , --Don't change this
    RElastWeight    = 1      , --Don't change this
    FLgcyElWeight    = 10    , --Don't change this
    RLgcyElWeight    = 10    , --Don't change this

    --Wear Regen
    RegenSpeed        = 3.6		, --Don't change this
}

local _AllTerrain = {

	TireWearOn         = true    ,

    --Friction and Wear
    FWearSpeed        = .3    , --Don't change this
    FTargetFriction    = .5   , -- .48 to .53
    FMinFriction     = 0.35   , --Don't change this

    RWearSpeed        = .3    , --Don't change this
    RTargetFriction    = .5  , -- .48 to .53
    RMinFriction    = 0.35    , --Don't change this

    --Tire Slip
    TCSOffRatio        = 1     , --Don't change this
    WheelLockRatio    = 1/6    , --Don't change this
    WheelspinRatio    = 1/1.2  ,  --Don't change this

    --Wheel Properties
    FFrictionWeight    = 10      , --Don't change this
    RFrictionWeight    = 10      , --Don't change this
    FLgcyFrWeight    = 0        , --Don't change this
    RLgcyFrWeight    = 0        , --Don't change this

    FElasticity        = 0     , --Don't change this
    RElasticity        = 0     , --Don't change this
    FLgcyElasticity    = 0     , --Don't change this
    RLgcyElasticity    = 0     , --Don't change this

    FElastWeight    = 1      , --Don't change this
    RElastWeight    = 1      , --Don't change this
    FLgcyElWeight    = 10    , --Don't change this
    RLgcyElWeight    = 10    , --Don't change this

    --Wear Regen
    RegenSpeed        = 3.6		, --Don't change this
}

local _DragRadials = {

	TireWearOn         = true    ,

    --Friction and Wear
    FWearSpeed        = 30    , --Don't change this
    FTargetFriction    = 1.2   , -- 1.18 to 1.23
    FMinFriction     = 0.35   , --Don't change this

    RWearSpeed        = 30    , --Don't change this
    RTargetFriction    = 1.2  , -- 1.18 to 1.23
    RMinFriction    = 0.35    , --Don't change this

    --Tire Slip
    TCSOffRatio        = 1     , --Don't change this
    WheelLockRatio    = 1/6    , --Don't change this
    WheelspinRatio    = 1/1.2  ,  --Don't change this

    --Wheel Properties
    FFrictionWeight    = 1      , --Don't change this
    RFrictionWeight    = 1      , --Don't change this
    FLgcyFrWeight    = 0        , --Don't change this
    RLgcyFrWeight    = 0        , --Don't change this

    FElasticity        = 0     , --Don't change this
    RElasticity        = 0     , --Don't change this
    FLgcyElasticity    = 0     , --Don't change this
    RLgcyElasticity    = 0     , --Don't change this

    FElastWeight    = 1      , --Don't change this
    RElastWeight    = 1      , --Don't change this
    FLgcyElWeight    = 10    , --Don't change this
    RLgcyElWeight    = 10    , --Don't change this

    --Wear Regen
    RegenSpeed        = 20		, --Don't change this
}

local car = script.Parent.Parent.Car.Value
local _Tune = require(car["A-Chassis Tune"])
local cValues = script.Parent.Parent:WaitForChild("Values")
local _WHEELTUNE = _AllSeason

if _Select == "DragRadials" then
	_WHEELTUNE = _DragRadials
elseif _Select == "Custom" then
	_WHEELTUNE = _Custom
elseif _Select == "AllTerrain" then
	_WHEELTUNE = _AllTerrain
elseif _Select == "Slicks" then
	_WHEELTUNE = _Slicks
elseif _Select == "SemiSlicks" then
	_WHEELTUNE = _SemiSlicks
else
	_WHEELTUNE = _AllSeason
end

car.DriveSeat.TireStats.Fwear.Value = _WHEELTUNE.FWearSpeed
car.DriveSeat.TireStats.Ffriction.Value = _WHEELTUNE.FTargetFriction
car.DriveSeat.TireStats.Fminfriction.Value = _WHEELTUNE.FMinFriction
car.DriveSeat.TireStats.Ffweight.Value = _WHEELTUNE.FFrictionWeight

car.DriveSeat.TireStats.Rwear.Value = _WHEELTUNE.RWearSpeed
car.DriveSeat.TireStats.Rfriction.Value = _WHEELTUNE.RTargetFriction
car.DriveSeat.TireStats.Rminfriction.Value = _WHEELTUNE.RMinFriction
car.DriveSeat.TireStats.Rfweight.Value = _WHEELTUNE.RFrictionWeight

car.DriveSeat.TireStats.TCS.Value = _WHEELTUNE.TCSOffRatio
car.DriveSeat.TireStats.Lock.Value = _WHEELTUNE.WheelLockRatio
car.DriveSeat.TireStats.Spin.Value = _WHEELTUNE.WheelspinRatio
car.DriveSeat.TireStats.Reg.Value = _WHEELTUNE.RegenSpeed


Prompt:
--[[
	Evercyan @ March 2023
	HealingFountain/Server

	Handles healing on the server-side
]]


Response:
while true do
	wait(0.5)
	local target = findNearestTorso(script.Parent.Head.Position)
	if target ~= nil then
		script.Parent.Humanoid:MoveTo(target.Position, target)
	end
	end


Prompt: --Variables

Response:
Car = script.Parent.Car.Value
Values = script.Parent.Values
_Tune = require(Car["A-Chassis Tune"])

Dash = Car.Body["Digital Dash"].Screen.SurfaceGui.MainFrame


Prompt:
--[[
	Calls the given callback, and stores any used external dependencies.
	Arguments can be passed in after the callback.
	If the callback completed successfully, returns true and the returned value,
	otherwise returns false and the error thrown.
	The callback shouldn't yield or run asynchronously.

	NOTE: any calls to useDependency() inside the callback (even if inside any
	nested captureDependencies() call) will not be included in the set, to avoid
	self-dependencies.
]]

Response:
local Package = script.Parent.Parent
local PubTypes = require(Package.PubTypes)
local parseError = require(Package.Logging.parseError)
local sharedState = require(Package.Dependencies.sharedState)

type Set<T> = {[T]: any}

local initialisedStack = sharedState.initialisedStack
local initialisedStackCapacity = 0

local function captureDependencies(
	saveToSet: Set<PubTypes.Dependency>,
	callback: (...any) -> any,
	...
): (boolean, any)

	local prevDependencySet = sharedState.dependencySet
	sharedState.dependencySet = saveToSet

	sharedState.initialisedStackSize += 1
	local initialisedStackSize = sharedState.initialisedStackSize

	local initialisedSet
	if initialisedStackSize > initialisedStackCapacity then
		initialisedSet = {}
		initialisedStack[initialisedStackSize] = initialisedSet
		initialisedStackCapacity = initialisedStackSize
	else
		initialisedSet = initialisedStack[initialisedStackSize]
		table.clear(initialisedSet)
	end

	local ok, value = xpcall(callback, parseError, ...)

	sharedState.dependencySet = prevDependencySet
	sharedState.initialisedStackSize -= 1

	return ok, value
end

return captureDependencies


Prompt:
--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

Response:
return function(player, dialogueFolder)
	local plrData = require(game.ReplicatedStorage.Source.Modules.Util):GetPlayerData(player)
	if plrData.Character.Injuries.BrokenLeg.Value == true then
		return true
	end
	return false
end


Prompt: -- This code will detect if exploiters are trying to disable the client-sided anti-exploit.

Response:
antiexploit.Changed:Connect(function()
	if antiexploit.Disabled then
		antiexploit.Enabled = true
	end
end)


Prompt: -- TODO add assertion for face string and enum

Response:
local function _assert(data)
	if data.SyncToAudio then
		assert(
			data.SyncToAudio.Audio ~= nil,
			"Failed to create config | expected an Audio for SyncToAudio, but received nil"
		)
		assert(
			data.SyncToAudio.StartAtAudioTime ~= nil,
			"Failed to create config | expected a StartAtAudioTime for SyncToAudio, but received nil"
		)
	else
		assert(
			data.StartTime ~= nil,
			"Failed to create config | expected config.StartTime or config.SyncToAudio, but received nil"
		)
	end

	assert(data.Adornee ~= nil, "Invalid Adornee | part expected got nil")
	assert(type(data.VideoId) == "string", ("Invalid VideoId | string expected got " .. type(data.VideoId)))
	if data.OnStart then
		assert(type(data.OnStart) == "function", ("Invalid OnStart | function expected got " .. type(data.OnStart)))
	end
	if data.OnEnd then
		assert(type(data.OnEnd) == "function", ("Invalid OnEnd | function expected got " .. type(data.OnEnd)))
	end

	if data.Face then
		assert(typeof(data.Face) == "EnumItem", ("Invalid Face Enum | enum expected got " .. typeof(data.Face)))
	end

	if data.Captions then
		local CaptionString = data.Captions.CaptionString
		assert(
			CaptionString ~= nil and type(CaptionString) == "string",
			("Invalid CaptionString | string expected got " .. type(CaptionString))
		)
	end
end

local Video = {}
Video.__index = Video
Video.Type = "Video"

Video.task = task

function Video:_constructVideo(videoId)
	self.SurfaceGui = Instance.new("SurfaceGui")
	-- TODO document this is a client only config
	local playerGui = Players.LocalPlayer:WaitForChild("PlayerGui")
	self.SurfaceGui.Adornee = self.Adornee
	self.SurfaceGui.Face = self.Face
	self.SurfaceGui.Name = self.Adornee.Name
	self.SurfaceGui.Parent = playerGui

	if self.SurfaceGuiProperties then
		for prop, value in pairs(self.SurfaceGuiProperties) do
			self.SurfaceGui[prop] = value
		end
	end

	self.VideoFrame = Instance.new("VideoFrame")
	self.VideoFrame.Video = videoId
	self.VideoFrame.Size = UDim2.new(1, 0, 1, 0)
	self.VideoFrame.Parent = self.SurfaceGui

	if self.Captions then
		self.VideoFrame:SetAttribute(enums.Attribute.Captions, self.Captions.CaptionString or "")
		self.CaptionsModule = CaptionsModule.new(self.VideoFrame)

		if self.CCButton then
			self.CCButton = self.CCButton:Clone()
		else
			self.CCButton = script.CCButton:Clone()
		end
		self.CCButton.Parent = self.SurfaceGui

		local captionLabel = self.CaptionsModule.CaptionLabel
		self.captionButtonConnection = self.CCButton.Activated:Connect(function()
			local areCaptionsVisible = captionLabel.Visible
			if areCaptionsVisible then
				self.CCButton.Image = ccOffIcon
			else
				self.CCButton.Image = ccIcon
			end
			captionLabel.Visible = not areCaptionsVisible
		end)
	end

	return self.VideoFrame
end

function Video:_calculateCurrentSoundIntensityRatio(video)
	local loudestPlayback = self.LoudestPlayback
	local loudness = video.volume
	self.LoudestPlayback = math.max(loudness, loudestPlayback)
	return loudness / self.LoudestPlayback
end

function Video.new(data)
	_assert(data)

	local self = setmetatable({}, Video)

	self.OnStart = data.OnStart or function(_config) end
	self.OnEnd = data.OnEnd or function(_config) end
	self.CurrentSoundIntensityRatio = 1
	self.LoudestPlayback = 1
	self.IsCancelled = false
	self.SyncToAudio = data.SyncToAudio
	self.VideoId = data.VideoId
	self.Adornee = data.Adornee
	self.Face = data.Face or Enum.NormalId.Top
	self.TimeLength = data.TimeLength
	self.SurfaceGuiProperties = data.SurfaceGuiProperties
	self.Captions = data.Captions
	self.CaptionsModule = data.CaptionsModule
	self.StartTime = data.StartTime

	if self.SyncToAudio then
		self.StartTime = self.SyncToAudio.Audio.StartTime + self.SyncToAudio.StartAtAudioTime
	end

	return self
end

function Video:_attemptOnStart()
	if self.OnStart ~= nil then
		SafeSpawn.new(function()
			self:OnStart()
		end)
	end
end

function Video:_attemptOnEnd()
	if self.OnEnd ~= nil then
		SafeSpawn.new(function()
			self:OnEnd()
		end)
	end
end

function Video:getSchemaProcessorTimePosition(schema)
	return schema.timePosition.Value
end

function Video:getCurrentSoundTimePosition()
	return self.SyncToAudio.Audio.Sound.TimePosition
end

function Video:Process(schemaProcessor, startTime)
	if self.SyncToAudio then
		if self.SyncToAudio.Audio ~= nil and self.SyncToAudio.Audio.IsDestroyed then
			self:_attemptOnEnd()
			return
		end
	end

	local currentTime = self:getSchemaProcessorTimePosition(schemaProcessor)
	local timeVideoFinishes = (startTime + self.TimeLength)
	if currentTime >= timeVideoFinishes then
		self:_attemptOnEnd()
		return
	end

	schemaProcessor.Maid:add(self, "SeekFlag")
	self.Video = self:_constructVideo(self.VideoId)

	if not self.Video.IsLoaded then
		print("Loading video")
		repeat
			self.task.wait()
		until self.IsCancelled or self.Video.IsLoaded
	end

	if not self.IsCancelled then
		print("Video loaded")
	end

	if self.SyncToAudio then
		while
			(self.SyncToAudio.Audio and not self.SyncToAudio.Audio.IsDestroyed and not self.IsCancelled)
			and (
				self.SyncToAudio.Audio
				and (
					self.SyncToAudio.Audio.Sound == nil
					or (self.SyncToAudio.Audio.Sound and self:getCurrentSoundTimePosition() < startTime)
				)
			)
		do
			self.task.wait()
		end
	end

	local timePositionOffset = schemaProcessor.timePosition.Value - startTime
	self.Video.TimePosition = timePositionOffset

	local videoOnEndConnection = self.Video.Ended:Connect(function()
		self:_attemptOnEnd()
	end)

	if self.captionButtonConnection then
		schemaProcessor.Maid:add(self.captionButtonConnection)
	end

	self.Video:Play()

	if self.Captions then
		SafeSpawn.new(function()
			self.CaptionsModule:Run()
			schemaProcessor.Maid:add(self.CaptionsModule, "Clean")
		end)
	end

	local intensityRatioCalculatorConnection = RunService.Heartbeat:Connect(function()
		self.CurrentSoundIntensityRatio = self:_calculateCurrentSoundIntensityRatio(self.Video)
	end)

	schemaProcessor.Maid:add(videoOnEndConnection)
	schemaProcessor.Maid:add(intensityRatioCalculatorConnection)
	schemaProcessor.Maid:add(self.Video)
	schemaProcessor.Maid:add(self.CCButton)
	schemaProcessor.Maid:add(self.SurfaceGui)

	if not self.IsCancelled then
		self:_attemptOnStart()
	end
end

function Video:SeekFlag()
	self.IsCancelled = true
end

return Video


Prompt: --// Processing

Response:
return function(Vargs, GetEnv)
	local env = GetEnv(nil, {script = script})
	setfenv(1, env)

	local server = Vargs.Server
	local service = Vargs.Service

	local Commands, Decrypt, Encrypt, AddLog, TrackTask, Pcall
	local Functions, Admin, Anti, Core, HTTP, Logs, Remote, Process, Variables, Settings, Defaults
	local logError = env.logError
	local Routine = env.Routine
	local function Init()
		Functions = server.Functions;
		Admin = server.Admin;
		Anti = server.Anti;
		Core = server.Core;
		HTTP = server.HTTP;
		Logs = server.Logs;
		Remote = server.Remote;
		Process = server.Process;
		Variables = server.Variables;
		Settings = server.Settings;
		Defaults = server.Defaults;

		logError = logError or env.logError;
		Routine = Routine or env.Routine;
		Commands = Remote.Commands
		Decrypt = Remote.Decrypt
		Encrypt = Remote.Encrypt
		AddLog = Logs.AddLog
		TrackTask = service.TrackTask
		Pcall = server.Pcall

		--// NetworkServer Events
		if service.NetworkServer then
			service.RbxEvent(service.NetworkServer.ChildAdded, server.Process.NetworkAdded)
			service.RbxEvent(service.NetworkServer.DescendantRemoving, server.Process.NetworkRemoved)
		end

		--// Necessary checks to prevent first time users from bypassing bans.
		service.Events.DataStoreAdd_Banned:Connect(function(data: table|string)
			local userId = if type(data) == "string" then tonumber(string.match(data, ":(%d+)$"))
					elseif type(data) == "table" then data.UserId
					else nil

			local plr = userId and service.Players:GetPlayerByUserId(userId)
			if plr then
				local reason = if type(data) == "table" and data.Reason then data.Reason
						else "No reason provided"
				pcall(plr.Kick, plr, string.format("%s | Reason: %s", Variables.BanMessage, reason))
				AddLog("Script", {
					Text = "Applied ban on "..plr.Name;
					Desc = "Ban reason: "..reason;
				})
			end
		end)
		service.Events["DataStoreAdd_Core.Variables.TimeBans"]:Connect(function(data)
			local userId = if type(data) == "string" then tonumber(string.match(data, ":(%d+)$"))
				elseif type(data) == "table" then data.UserId
				else nil

			local plr = userId and service.Players:GetPlayerByUserId(userId)
			if plr then
				local reason = if type(data) == "table" and data.Reason then data.Reason
					else "No reason provided"

				pcall(
					plr.Kick,
					plr,
					string.format(
						"\n Reason: %s\n Banned until %s",
						(reason or "(No reason provided."),
						service.FormatTime(data.EndTime, { WithWrittenDate = true })
					)
				)
				AddLog("Script", {
					Text = "Applied TimeBan on ".. plr.Name;
					Desc = "Ban reason: ".. reason;
				})
			end
		end)

		Process.Init = nil
		AddLog("Script", "Processing Module Initialized")
	end;

	local function RunAfterPlugins(data)
		local existingPlayers = service.Players:GetPlayers()

		--// Events
		service.RbxEvent(service.Players.PlayerAdded, service.EventTask("PlayerAdded", Process.PlayerAdded))
		service.RbxEvent(service.Players.PlayerRemoving, service.EventTask("PlayerRemoving", Process.PlayerRemoving))

		--// Load client onto existing players
		if existingPlayers then
			for i, p in existingPlayers do
				Core.LoadExistingPlayer(p)
			end
		end

		service.TrackTask("Thread: ChatCharacterLimit", function()
			local ChatModules = service.Chat:WaitForChild("ClientChatModules", 5)
			if ChatModules then
				local ChatSettings = ChatModules:WaitForChild("ChatSettings", 5)
				if ChatSettings then
					local success, ChatSettingsModule = pcall(function()
						return require(ChatSettings)
					end)
					if success then
						local NewChatLimit = ChatSettingsModule.MaximumMessageLength
						if NewChatLimit and type(NewChatLimit) == "number" then
							Process.MaxChatCharacterLimit = NewChatLimit
							AddLog("Script", "Chat Character Limit automatically set to " .. NewChatLimit)
						end
					else
						AddLog("Script", "Failed to automatically get ChatSettings Character Limit, ignore if you use a custom chat system")
					end
				end
			end
		end)

		Process.RunAfterPlugins = nil
		AddLog("Script", "Process Module RunAfterPlugins Finished")
	end

	local function newRateLimit(rateLimit: table, rateKey: string|number|userdata|any)
		-- Ratelimit: table
		-- Ratekey: string or number

		local rateData = (type(rateLimit)=="table" and rateLimit) or nil

		if not rateData then
			error("Rate data doesn't exist (unable to check)")
		else
			-- RATELIMIT TABLE
		--[[

			Table:
				{
					Rates = 100; 	-- Max requests per traffic
					Reset = 1; 		-- Interval seconds since the cache last updated to reset

					ThrottleEnabled = false/true; -- Whether throttle can be enabled
					ThrottleReset = 10; -- Interval seconds since the cache last throttled to reset
					ThrottleMax = 10; -- Max interval count of throttles

					Caches = {}; -- DO NOT ADD THIS. IT WILL AUTOMATICALLY BE CREATED ONCE RATELIMIT TABLE IS CHECKING-
					--... FOR RATE PASS AND THROTTLE CHECK.
				}

		]]

			-- RATECACHE TABLE
		--[[

			Table:
				{
					Rate = 0;
					Throttle = 0; 		-- Interval seconds since the cache last updated to reset

					LastUpdated = 0; -- Last checked for rate limit
					LastThrottled = nil or 0; -- Last checked for throttle (only changes if rate limit failed)
				}

		]]
			local maxRate: number = math.abs(rateData.Rates) -- Max requests per traffic
			local resetInterval: number = math.floor(math.abs(rateData.Reset or 1)) -- Interval seconds since the cache last updated to reset

			local rateExceeded: boolean? = rateLimit.Exceeded or rateLimit.exceeded
			local ratePassed: boolean? = rateLimit.Passed or rateLimit.passed

			local canThrottle: boolean? = rateLimit.ThrottleEnabled
			local throttleReset: number? = rateLimit.ThrottleReset
			local throttleMax: number? = math.floor(math.abs(rateData.ThrottleMax or 1))

			-- Ensure minimum requirement is followed
			maxRate = (maxRate>1 and maxRate) or 1
			-- Max rate must have at least one rate else anything below 1 returns false for all rate checks

			local cacheLib = rateData.Caches

			if not cacheLib then
				cacheLib = {}
				rateData.Caches = cacheLib
			end

			-- Check cache
			local rateCache: table = cacheLib[rateKey]
			local throttleCache
			if not rateCache then
				rateCache = {
					Rate = 0;
					Throttle = 0;
					LastUpdated = tick();
					LastThrottled = nil;
				}

				cacheLib[rateKey] = rateCache
			end

			local nowOs = tick()

			if nowOs-rateCache.LastUpdated > resetInterval then
				rateCache.LastUpdated = nowOs
				rateCache.Rate = 0
			end

			local ratePass: boolean = rateCache.Rate+1<=maxRate

			local didThrottle: boolean = canThrottle and rateCache.Throttle+1<=throttleMax
			local throttleResetOs: number? = rateCache.ThrottleReset
			local canResetThrottle: boolean = throttleResetOs and nowOs-throttleResetOs <= 0

			rateCache.Rate += 1

			-- Check can throttle and whether throttle could be reset
			if canThrottle and canResetThrottle then
				rateCache.Throttle = 0
			end

			-- If rate failed and can also throttle, count tick
			if canThrottle and (not ratePass and didThrottle) then
				rateCache.Throttle += 1
				rateCache.LastThrottled = nowOs

				-- Check whether cache time expired and replace it with a new one or set a new one
				if not throttleResetOs or canResetThrottle then
					rateCache.ThrottleReset = nowOs
				end
			elseif canThrottle and ratePass then
				rateCache.Throttle = 0
			end

			if rateExceeded and not ratePass then
				rateExceeded:fire(rateKey, rateCache.Rate, maxRate)
			end

			if ratePassed and ratePass then
				ratePassed:fire(rateKey, rateCache.Rate, maxRate)
			end

			return ratePass, didThrottle, canThrottle, rateCache.Rate, maxRate, throttleResetOs
		end
	end

	local RateLimiter = {
		Remote = {
			Rates = 120;
			Reset = 60;
		};
		Command = {
			Rates = 20;
			Reset = 40;
		};
		Chat = {
			Rates = 10;
			Reset = 1;
		};
		CustomChat = {
			Rates = 10;
			Reset = 1;
		};
		RateLog = {
			Rates = 10;
			Reset = 2;
		};
	}

	local unWrap = service.unWrap
	local function RateLimit(p, typ)
		local isPlayer = type(p)=="userdata" and p:IsA"Player"
		if isPlayer then
			local rateData = RateLimiter[typ]
			assert(rateData, "No rate limit data available for the given type "..typ)
			local ratePass, didThrottle, canThrottle, curRate, maxRate = newRateLimit(rateData, p.UserId)
			return ratePass, didThrottle, canThrottle, curRate, maxRate
		else
			return true
		end
	end

	server.Process = {
		Init = Init;
		RunAfterPlugins = RunAfterPlugins;
		RateLimit = RateLimit;
		newRateLimit = newRateLimit;
		MsgStringLimit = 500; --// Max message string length to prevent long length chat spam server crashing (chat & command bar); Anything over will be truncated;
		MaxChatCharacterLimit = 250; --// Roblox chat character limit; The actual limit of the Roblox chat's textbox is 200 characters; I'm paranoid so I added 50 characters; Users should not be able to send a message larger than that;
		RateLimits = {
			Remote = 0.01;
			Command = 0.1;
			Chat = 0.1;
			CustomChat = 0.1;
			RateLog = 10;
		};

		Remote = function(p, cliData, com, ...)
			local key = tostring(p.UserId)
			local keys = Remote.Clients[key]

			if p and p:IsA("Player") then
				if Anti.KickedPlayers[p] then
					p:Kick(":: Adonis :: Communication following disconnect.")
				elseif not com or type(com) ~= "string" or #com > 50 or cliData == "BadMemes" or com == "BadMemes" then
					Anti.Detected(p, "Kick", (tostring(com) ~= "BadMemes" and tostring(com)) or tostring(select(1, ...)))
				elseif cliData and type(cliData) ~= "table" then
					Anti.Detected(p, "Kick", "Invalid Client Data (r10002)")
					--elseif cliData and keys and cliData.Module ~= keys.Module then
					--	Anti.Detected(p, "Kick", "Invalid Client Module (r10006)")
				else
					local args = {...}
					local rateLimitCheck, didThrottleRL, canThrottleRL, curRemoteRate = RateLimit(p, "Remote")

					if keys then
						keys.LastUpdate = os.time()
						keys.Received += 1

						if type(com) == "string" then
							if com == keys.Special.."GET_KEY" then
								if keys.LoadingStatus == "WAITING_FOR_KEY" then
									Remote.Fire(p, keys.Special.."GIVE_KEY", keys.Key)
									keys.LoadingStatus = "LOADING"
									keys.RemoteReady = true

									AddLog("Script", string.format("%s requested client keys", p.Name))
									--else
									--Anti.Detected(p, "kick","Communication Key Error (r10003)")
								end

								AddLog("RemoteFires", {
									Text = p.Name.." requested key from server",
									Desc = "Player requested key from server",
									Player = p;
								})
							elseif rateLimitCheck and string.len(com) <= Remote.MaxLen then
								local comString = Decrypt(com, keys.Key, keys.Cache)
								local command = (cliData.Mode == "Get" and Remote.Returnables[comString]) or Remote.Commands[comString]

								AddLog("RemoteFires", {
									Text = string.format("%s fired %s; Arg1: %s", tostring(p), comString, tostring(args[1]));
									Desc = string.format("Player fired remote command %s; %s", comString, Functions.ArgsToString(args));
									Player = p;
								})

								if command then
									local rets = {TrackTask("Remote: ".. p.Name ..": ".. tostring(comString), command, p, args)}
									if not rets[1] then
										logError(p, tostring(comString) .. ": ".. tostring(rets[2]))
									else
										return {unpack(rets, 2)}
									end
								else
									Anti.Detected(p, "Kick", "Invalid Remote Data (r10004)")
								end
							elseif rateLimitCheck and RateLimit(p, "RateLog") then
								Anti.Detected(p, "Log", string.format("Firing RemoteEvent too quickly (>Rate: %s/sec)", curRemoteRate));
								warn(string.format("%s is firing Adonis's RemoteEvent too quickly (>Rate: %s/sec)", p.Name, curRemoteRate));
							end
						else
							Anti.Detected(p, "Log", "Out of Sync (r10005)")
						end
					end
				end
			end
		end;

		Command = function(p, msg, opts, noYield)
			opts = opts or {}

			--[[if Admin.IsBlacklisted(p) then
				return false
			end]]

			if #msg > Process.MsgStringLimit and type(p) == "userdata" and p:IsA("Player") and not Admin.CheckAdmin(p) then
				msg = string.sub(msg, 1, Process.MsgStringLimit)
			end

			msg = Functions.Trim(msg)

			if string.match(msg, Settings.BatchKey) then
				for cmd in string.gmatch(msg,'[^'..Settings.BatchKey..']+') do
					cmd = Functions.Trim(cmd)

					local waiter = Settings.PlayerPrefix.."wait"
					if string.sub(string.lower(cmd), 1, #waiter) == waiter then
						local num = tonumber(string.sub(cmd, #waiter + 1))

						if num then
							wait(tonumber(num))
						end
					else
						Process.Command(p, cmd, opts, false)
					end
				end
			else
				local pData = opts.PlayerData or (p and Core.GetPlayer(p))
				msg = (pData and Admin.AliasFormat(pData.Aliases, msg)) or msg

				if string.match(msg, Settings.BatchKey) then
					return Process.Command(p, msg, opts, false)
				end

				local index, command, matched = Admin.GetCommand(msg)
				if not command then
					if opts.Check then
						Remote.MakeGui(p, "Output", {
							Title = "Output";
							Message = if Settings.SilentCommandDenials
								then string.format("'%s' is either not a valid command, or you do not have permission to run it.", msg)
								else string.format("'%s' is not a valid command.", msg);
						})
					end
					return
				end

				local allowed, denialMessage = false, nil
				local isSystem = false

				local pDat = {
					Player = opts.Player or p;
					Level = opts.AdminLevel or Admin.GetLevel(p);
					isDonor = opts.IsDonor or (Admin.CheckDonor(p) and (Settings.DonorCommands or command.AllowDonors));
				}

				if opts.isSystem or p == "SYSTEM" then
					isSystem = true
					allowed = not command.Disabled
					p = p or "SYSTEM"
				else
					allowed, denialMessage = Admin.CheckPermission(pDat, command, false, opts)
				end

				if not allowed then
					if not (isSystem or opts.NoOutput) and (denialMessage or not Settings.SilentCommandDenials or opts.Check) then
						Remote.MakeGui(p, "Output", {
							Message = denialMessage or (if Settings.SilentCommandDenials
								then string.format("'%s' is either not a valid command, or you do not have permission to run it.", msg)
								else string.format("You do not have permission to run '%s'.", msg));
						})
					end
					return
				end

				local cmdArgs = command.Args or command.Arguments
				local argString = string.match(msg, "^.-"..Settings.SplitKey.."(.+)") or ""
				local args = (opts.Args or opts.Arguments) or (#cmdArgs > 0 and Functions.Split(argString, Settings.SplitKey, #cmdArgs)) or {}

				local taskName = string.format("Command :: %s : (%s)", p.Name, msg)

				if #args > 0 and not isSystem and command.Filter or opts.Filter then
					for i, arg in args do
						local cmdArg = cmdArgs[i]
						if cmdArg then
							if Admin.IsLax(cmdArg) == false then
								args[i] = service.LaxFilter(arg, p)
							end
						else
							args[i] = service.LaxFilter(arg, p)
						end
					end
				end

				if opts.CrossServer or (not isSystem and not opts.DontLog) then
					AddLog("Commands", {
						Text = ((opts.CrossServer and "[CRS_SERVER] ") or "") .. p.Name;
						Desc = matched .. Settings.SplitKey .. table.concat(args, Settings.SplitKey);
						Player = p;
					})

					if Settings.ConfirmCommands then
						Functions.Hint("Executed Command: [ "..msg.." ]", {p})
					end
				end

				if noYield then
					taskName = "Thread: " .. taskName
				end

				Admin.UpdateCooldown(pDat, command)
				local ran, cmdError = TrackTask(taskName, command.Function, p, args, {
					PlayerData = pDat,
					Options = opts
				})

				if not opts.IgnoreErrors then
					if type(cmdError) == "string" then
						AddLog("Errors", "["..matched.."] "..cmdError)

						cmdError = cmdError:match("%d: (.+)$") or cmdError

						if not isSystem then
							Remote.MakeGui(p, "Output", {
								Message = cmdError,
							})
						end
					elseif cmdError ~= nil and cmdError ~= true and not isSystem then
						Remote.MakeGui(p, "Output", {
							Message = "There was an error but the error was not a string? : "..tostring(cmdError);
						})
					end
				end

				service.Events.CommandRan:Fire(p, {
					Message = msg,
					Matched = matched,
					Args = args,
					Command = command,
					Index = index,
					Success = ran,
					Error = if type(cmdError) == "string" then cmdError else nil,
					Options = opts,
					PlayerData = pDat
				})
			end
		end;

		CrossServerChat = function(data)
			if data then
				for _, v in service.GetPlayers() do
					if Admin.GetLevel(v) > 0 then
						Remote.Send(v, "handler", "ChatHandler", data.Player, data.Message, "Cross")
					end
				end
			end
		end;

		CustomChat = function(p, a, b, canCross)
			local didPassRate, didThrottle, canThrottle, curRate, maxRate = RateLimit(p, "CustomChat")

			if didPassRate and not Admin.IsMuted(p) then
				if type(a) == "string" then
					a = string.sub(a, 1, Process.MsgStringLimit)
				end

				if b == "Cross" then
					if canCross and Admin.CheckAdmin(p) then
						Core.CrossServer("ServerChat", {Player = p.Name, Message = a})
						--Core.SetData("CrossServerChat",{Player = p.Name, Message = a})
					end
				else
					local target = Settings.SpecialPrefix..'all'
					if not b then
						b = 'Global'
					end
					if not service.Players:FindFirstChild(p.Name) then
						b='Nil'
					end
					if string.sub(a,1,1)=='@' then
						b='Private'
						target,a=string.match(a,'@(.%S+) (.+)')
						Remote.Send(p,'Function','SendToChat',p,a,b)
					elseif string.sub(a,1,1)=='#' then
						if string.sub(a,1,7)=='#ignore' then
							target=string.sub(a,9)
							b='Ignore'
						end
						if string.sub(a,1,9)=='#unignore' then
							target=string.sub(a,11)
							b='UnIgnore'
						end
					end

					for _, v in service.GetPlayers(p, target, {
						DontError = true;
						})
					do
						local a = service.Filter(a, p, v)
						if p.Name == v.Name and b ~= "Private" and b ~= "Ignore" and b ~= "UnIgnore" then
							Remote.Send(v,"Handler","ChatHandler",p,a,b)
						elseif b == "Global" then
							Remote.Send(v,"Handler","ChatHandler",p,a,b)
						elseif b == "Team" and p.TeamColor == v.TeamColor then
							Remote.Send(v,"Handler","ChatHandler",p,a,b)
						elseif b == "Local" and p:DistanceFromCharacter(v.Character.Head.Position) < 80 then
							Remote.Send(v,"Handler","ChatHandler",p,a,b)
						elseif b == "Admins" and Admin.CheckAdmin(p) then
							Remote.Send(v,"Handler","ChatHandler",p,a,b)
						elseif b == "Private" and v.Name ~= p.Name then
							Remote.Send(v,"Handler","ChatHandler",p,a,b)
						elseif b == "Nil" then
							Remote.Send(v,"Handler","ChatHandler",p,a,b)
							--[[elseif b == 'Ignore' and v.Name ~= p.Name then
								Remote.Send(v,'AddToTable','IgnoreList',v.Name)
							elseif b == 'UnIgnore' and v.Name ~= p.Name then
								Remote.Send(v,'RemoveFromTable','IgnoreList',v.Name)--]]
						end
					end
				end

				service.Events.CustomChat:Fire(p,a,b)
			elseif not didPassRate and RateLimit(p, "RateLog") then
				Anti.Detected(p, "Log", string.format("CustomChatting too quickly (>Rate: %s/sec)", curRate))
				warn(string.format("%s is CustomChatting too quickly (>Rate: %s/sec)", p.Name, curRate))
			end
		end;

		Chat = function(p, msg)
			local didPassRate, didThrottle, canThrottle, curRate, maxRate = RateLimit(p, "Chat")
			if didPassRate then
				local isMuted = Admin.IsMuted(p);
				if utf8.len(utf8.nfcnormalize(msg)) > Process.MaxChatCharacterLimit and not Admin.CheckAdmin(p) then
					Anti.Detected(p, "Kick", "Chatted message over the maximum character limit")
				elseif not isMuted then
					local msg = string.sub(msg, 1, Process.MsgStringLimit)
					local filtered = service.LaxFilter(msg, p)

					AddLog(Logs.Chats, {
						Text = p.Name..": " .. tostring(filtered);
						Desc = tostring(filtered);
						Player = p;
					})

					if Settings.ChatCommands then
						if Admin.DoHideChatCmd(p, msg) then
							Remote.Send(p,"Function","ChatMessage","> "..msg,Color3.new(1, 1, 1))
							Process.Command(p, msg, {Chat = true;})
						elseif string.sub(msg, 1, 3) == "/e " then
							service.Events.PlayerChatted:Fire(p, msg)
							msg = string.sub(msg, 4)
							Process.Command(p, msg, {Chat = true;})
						elseif string.sub(msg, 1, 8) == "/system " then
							service.Events.PlayerChatted:Fire(p, msg)
							msg = string.sub(msg, 9)
							Process.Command(p, msg, {Chat = true;})
						else
							service.Events.PlayerChatted:Fire(p, msg)
							Process.Command(p, msg, {Chat = true;})
						end
					else
						service.Events.PlayerChatted:Fire(p, msg)
					end
				elseif isMuted then
					local msg = string.sub(msg, 1, Process.MsgStringLimit);
					local filtered = service.LaxFilter(msg, p)
					AddLog(Logs.Chats, {
						Text = "[MUTED] ".. p.Name ..": "..tostring(filtered);
						Desc = tostring(filtered);
						Player = p;
					})
				end
			elseif not didPassRate and RateLimit(p, "RateLog") then
				Anti.Detected(p, "Log", string.format("Chatting too quickly (>Rate: %s/sec)", curRate))
				warn(string.format("%s is chatting too quickly (>Rate: %s/sec)", p.Name, curRate))
			end
		end;

		--[==[
				WorkspaceChildAdded = function(c)
					--[[if c:IsA("Model") then
						local p = service.Players:GetPlayerFromCharacter(c)
						if p then
							service.TrackTask(p.Name..": CharacterAdded", Process.CharacterAdded, p)
						end
					end

					-- Moved to PlayerAdded handler
					--]]
				end;

				LogService = function(Message, Type)
					--service.Events.Output:Fire(Message, Type)
				end;

				ErrorMessage = function(Message, Trace, Script)
					--[[if Running then
						service.Events.ErrorMessage:Fire(Message, Trace, Script)
						if Message:lower():find("adonis") or Message:find(script.Name) then
							logError(Message)
						end
					end--]]
				end;
		]==]

		PlayerAdded = function(p)
			AddLog("Script", "Doing PlayerAdded Event for ".. p.Name)

			local key = tostring(p.UserId)
			local keyData = {
				Player = p;
				Key = Functions.GetRandom();
				Cache = {};
				Sent = 0;
				Received = 0;
				LastUpdate = os.time();
				FinishedLoading = false;
				LoadingStatus = "WAITING_FOR_KEY";
				--Special = Core.MockClientKeys and Core.MockClientKeys.Special;
				--Module = Core.MockClientKeys and Core.MockClientKeys.Module;
			}

			Core.UpdatePlayerConnection(p)
			Core.PlayerData[key] = nil
			Remote.Clients[key] = keyData

			local ran, err = Pcall(function()
				Routine(function()
					if Anti.UserSpoofCheck(p) then
						Remote.Clients[key] = nil;
						Anti.Detected(p, "kick", "Username Spoofing");
					end
				end)

				local PlayerData = Core.GetPlayer(p)
				local level = Admin.GetLevel(p)
				local banned, reason = Admin.CheckBan(p)

				if banned then
					Remote.Clients[key] = nil;
					p:Kick(string.format("%s | Reason: %s", Variables.BanMessage, (reason or "No reason provided")))
					return "REMOVED"
				end

				if Variables.ServerLock and level < 1 then
					Remote.Clients[key] = nil;
					p:Kick(Variables.LockMessage or "::Adonis::\nServer Locked")
					return "REMOVED"
				end

				if Variables.Whitelist.Enabled then
					local listed = false

					local CheckTable = Admin.CheckTable
					for listName, list in Variables.Whitelist.Lists do
						if CheckTable(p, list) then
							listed = true
							break;
						end
					end

					if not listed and level == 0 then
						Remote.Clients[key] = nil;
						p:Kick(Variables.LockMessage or "::Adonis::\nWhitelist Enabled")
						return "REMOVED"
					end
				end
			end)

			if not ran then
				AddLog("Errors", p.Name .." PlayerAdded Failed: ".. tostring(err))
				warn("~! :: Adonis :: SOMETHING FAILED DURING PLAYERADDED:")
				warn(tostring(err))
			end

			if Remote.Clients[key] then
				Core.HookClient(p)

				AddLog("Script", {
					Text = p.Name .. " loading started";
					Desc = p.Name .. " successfully joined the server";
				})

				AddLog("Joins", {
					Text = p.Name;
					Desc = p.Name.." joined the server";
					Player = p;
				})

				--// Get chats
				p.Chatted:Connect(function(msg)
					local ran, err = TrackTask(p.Name .. "Chatted", Process.Chat, p, msg)
					if not ran then
						logError(err);
					end
				end)

				--// Character added
				p.CharacterAdded:Connect(function(...)
					local ran, err = TrackTask(p.Name .. "CharacterAdded", Process.CharacterAdded, p, ...)
					if not ran then
						logError(err);
					end
				end)

				delay(600, function()
					if p.Parent and Core.PlayerData[key] and Remote.Clients[key] and Remote.Clients[key] == keyData and keyData.LoadingStatus ~= "READY" then
						AddLog("Script", {
							Text = p.Name .. " Failed to Load",
							Desc = tostring(keyData.LoadingStatus)..": Client failed to load in time (10 minutes?)",
							Player = p;
						});
						--Anti.Detected(p, "kick", "Client failed to load in time (10 minutes?)");
					end
				end)
			elseif ran and err ~= "REMOVED" then
				Anti.RemovePlayer(p, "\n:: Adonis ::\nLoading Error [Missing player, keys, or removed]")
			end
		end;

		PlayerRemoving = function(p)
			local data = Core.GetPlayer(p)
			local key = tostring(p.UserId)

			service.Events.PlayerRemoving:Fire(p)

			delay(1, function()
				if not service.Players:GetPlayerByUserId(p.UserId) then
					Core.PlayerData[key] = nil
				end
			end)

			AddLog("Script", {
				Text = string.format("Triggered PlayerRemoving for %s", p.Name);
				Desc = "Player left the game (PlayerRemoving)";
				Player = p;
			})

			AddLog("Leaves", {
				Text = p.Name;
				Desc = p.Name.." left the server";
				Player = p;
			})

			Core.SavePlayerData(p, data)

			Variables.TrackingTable[p.Name] = nil
			for otherPlrName, trackTargets in Variables.TrackingTable do
				if trackTargets[p] then
					trackTargets[p] = nil
					local otherPlr = service.Players:FindFirstChild(otherPlrName)
					if otherPlr then
						task.defer(Remote.RemoveLocal, otherPlr, p.Name.."Tracker")
					end
				end
			end

			if Commands.UnDisguise then
				Commands.UnDisguise.Function(p, {"me"})
			end

			Variables.IncognitoPlayers[p] = nil
		end;

		FinishLoading = function(p)
			local PlayerData = Core.GetPlayer(p)
			local level = Admin.GetLevel(p)
			local key = tostring(p.UserId)

			--// Fire player added
			service.Events.PlayerAdded:Fire(p)
			AddLog("Script", {
				Text = string.format("%s finished loading", p.Name);
				Desc = "Client finished loading";
			})

			--// Run OnJoin commands
			for i,v in Settings.OnJoin do
				TrackTask("Thread: OnJoin_Cmd: ".. tostring(v), Admin.RunCommandAsPlayer, v, p)
				AddLog("Script", {
					Text = "OnJoin: Executed "..tostring(v);
					Desc = "Executed OnJoin command; "..tostring(v)
				})
			end

			--// Start keybind listener
			Remote.Send(p, "Function", "KeyBindListener", PlayerData.Keybinds or {})

			--// Load some playerdata stuff
			if type(PlayerData.Client) == "table" then
				if PlayerData.Client.CapesEnabled == true or PlayerData.Client.CapesEnabled == nil then
					Remote.Send(p, "Function", "MoveCapes")
				end
				Remote.Send(p, "SetVariables", PlayerData.Client)
			else
				Remote.Send(p, "Function", "MoveCapes")
			end

			--// Load all particle effects that currently exist
			Functions.LoadEffects(p)

			--// Load admin or non-admin specific things
			if level < 1 then
				if Settings.AntiSpeed then
					Remote.Send(p, "LaunchAnti", "Speed", {
						Speed = tostring(60.5 + math.random(9e8)/9e8)
					})
				end

				if Settings.Detection then
					Remote.Send(p, "LaunchAnti", "MainDetection")
				end

				if Settings.AntiBuildingTools then
					Remote.Send(p, "LaunchAnti", "AntiTools", {BTools = true})
				end
			end

			--// Finish things up
			if Remote.Clients[key] then
				Remote.Clients[key].FinishedLoading = true
				if p.Character and p.Character.Parent == workspace then
					--service.Threads.TimeoutRunTask(p.Name..";CharacterAdded",Process.CharacterAdded,60,p)
					local ran, err = TrackTask(p.Name .." CharacterAdded", Process.CharacterAdded, p, p.Character)
					if not ran then
						logError(err)
					end
				else
					if Settings.Console and (not Settings.Console_AdminsOnly or level > 0) then
						Remote.MakeGui(p, "Console")
					end

					if Settings.HelpButton then
						Remote.MakeGui(p, "HelpButton")
					end
				end

				if level > 0 then
					local oldVer = (level > 300) and Core.GetData("VersionNumber")
					local newVer = (level > 300) and tonumber(string.match(server.Changelog[1], "Version: (.*)"))

					if Settings.Notification then
						wait(2)

						Remote.MakeGui(p, "Notification", {
							Title = "Welcome.";
							Message = "Click here for commands.";
							Icon = server.MatIcons["Verified user"];
							Time = 15;
							OnClick = Core.Bytecode("client.Remote.Send('ProcessCommand','"..Settings.Prefix.."cmds')");
						})

						wait(1)

						if oldVer and newVer and newVer > oldVer then
							Remote.MakeGui(p, "Notification", {
								Title = "Updated!";
								Message = "Click to view the changelog.";
								Icon = server.MatIcons.Description;
								Time = 10;
								OnClick = Core.Bytecode("client.Remote.Send('ProcessCommand','"..Settings.Prefix.."changelog')");
							})
						end

						wait(1)

						if level > 300 and Settings.DataStoreKey == Defaults.Settings.DataStoreKey then
							Remote.MakeGui(p, "Notification", {
								Title = "Warning!";
								Message = "Using default datastore key!";
								Icon = server.MatIcons.Description;
								Time = 10;
								OnClick = Core.Bytecode([[
									local window = client.UI.Make("Window", {
										Title = "How to change the DataStore key";
										Size = {700,300};
										Icon = "rbxassetid://7510994359";
									})

									window:Add("ImageLabel", {
										Image = "rbxassetid://1059543904";
									})

									window:Ready()
								]]);
							})
						end
					end

					if newVer then
						Core.SetData("VersionNumber", newVer)
					end
				end

				--// REF_1_ALBRT - 57s_Dxl - 100392_659;
				--// COMP[[CHAR+OFFSET] < INT[0]]
				--// EXEC[[BYTE[N]+BYTE[x]] + ABS[CHAR+OFFSET]]
				--// ELSE[[BYTE[A]+BYTE[x]] + ABS[CHAR+OFFSET]]
				--// VALU -> c_BYTE ; CAT[STR,x,c_BYTE] -> STR ; OUT[STR]]]
				--// [-150x261x247x316x246x243x238x248x302x316x261x247x316x246x234x247x247x302]
				--// END_ReF - 100392_659

				for v: Player in Variables.IncognitoPlayers do
					--// Check if the Player still exists before doing incognito to prevent LoadCode spam.
					if v == p or v.Parent == service.Players then
						continue
					end

					Remote.LoadCode(p, [[
						local plr = service.Players:GetPlayerByUserId(]] .. v.UserId .. [[)
						if plr then
							if not table.find(service.IncognitoPlayers, plr) then
								table.insert(service.IncognitoPlayers, plr)
							end

							plr:Remove()
						end
					]])
				end
			end
		end;

		CharacterAdded = function(p, char, ...)
			local key = tostring(p.UserId)
			local keyData = Remote.Clients[key]

			if keyData then
				keyData.PlayerLoaded = true
			end

			wait(1 / 60)
			if char and keyData and keyData.FinishedLoading then
				local level = Admin.GetLevel(p)

				--// Wait for UI stuff to finish
				wait(1)
				if not p:FindFirstChildWhichIsA("PlayerGui") then
					p:WaitForChild("PlayerGui", 9e9)
				end
				Remote.Get(p,"UIKeepAlive")

				--//GUI loading
				local MakeGui = Remote.MakeGui
				local Refresh = Remote.RefreshGui
				local RefreshGui = function(gui, ignore, ...)
					Refresh(p, gui, ignore, ...)
				end
				if Variables.NotifMessage then
					MakeGui(p, "Notif", {
						Message = Variables.NotifMessage
					})
				end

				if Settings.Console and (not Settings.Console_AdminsOnly or (Settings.Console_AdminsOnly and level > 0)) then
					RefreshGui("Console")
				end

				if Settings.HelpButton then
					MakeGui(p, "HelpButton")
				end

				if Settings.TopBarShift then
					MakeGui(p, "TopBar")
				end

				--if Settings.CustomChat then
				--	MakeGui(p, "Chat")
				--end

				--if Settings.PlayerList then
				--	MakeGui(p, "PlayerList")
				--end

				if level < 1 then
					if Settings.AntiNoclip then
						Remote.Send(p, "LaunchAnti", "HumanoidState")
					end
				end

				--// Check muted
				--[=[for ind,admin in Settings.Muted do
					if Admin.DoCheck(p, admin) then
						Remote.LoadCode(p, [[service.StarterGui:SetCoreGuiEnabled("Chat",false) client.Variables.ChatEnabled = false client.Variables.Muted = true]])
					end
				end--]=]

				task.spawn(Functions.Donor, p)

				--// Fire added event
				service.Events.CharacterAdded:Fire(p, char, ...)

				--// Run OnSpawn commands
				for _, v in Settings.OnSpawn do
					TrackTask("Thread: OnSpawn_Cmd: ".. tostring(v), Admin.RunCommandAsPlayer, v, p)
					AddLog("Script", {
						Text = "OnSpawn: Executed "..tostring(v);
						Desc = "Executed OnSpawn command; "..tostring(v);
					})
				end

				if
					server.Commands.Track
					and char:WaitForChild("Head", 5)
					and char:WaitForChild("HumanoidRootPart", 2)
				then
					for otherPlrName, trackTargets in Variables.TrackingTable do
						if trackTargets[p] then
							server.Commands.Track.Function(service.Players[otherPlrName], {"@"..p.Name, "true"})
						end
					end
				end
			end
		end;

		NetworkAdded = function(cli)
			wait(0.25)

			local p = cli:GetPlayer()

			if p then
				Core.Connections[cli] = p

				AddLog("Script", {
					Text = p.Name .. " connected";
					Desc = p.Name .. " successfully established a connection with the server";
					Player = p;
				})
			else
				AddLog("Script", {
					Text = "<UNKNOWN> connected";
					Desc = "An unknown user successfully established a connection with the server";
				})
			end

			service.Events.NetworkAdded:Fire(cli)
		end;

		NetworkRemoved = function(cli)
			local p = cli:GetPlayer() or Core.Connections[cli]

			Core.Connections[cli] = nil

			if p then
				Anti.KickedPlayers[p] = nil
				AddLog("Script", {
					Text = p.Name .. " disconnected";
					Desc = p.Name .. " disconnected from the server";
					Player = p;
				})
			else
				AddLog("Script", {
					Text = "<UNKNOWN> disconnected";
					Desc = "An unknown user disconnected from the server";
				})
			end

			service.Events.NetworkRemoved:Fire(cli)
		end;

		--[[
		PlayerTeleported = function(p,data)

		end;
		]]
	};
end


Prompt:
--[[
	Constructs and returns objects which can be used to model derived reactive
	state.
]]

Response:
local Package = script.Parent.Parent
local captureDependencies = require(Package.Dependencies.captureDependencies)
local initDependency = require(Package.Dependencies.initDependency)
local useDependency = require(Package.Dependencies.useDependency)
local logErrorNonFatal = require(Package.Logging.logErrorNonFatal)

local class = {}

local CLASS_METATABLE = {__index = class}
local WEAK_KEYS_METATABLE = {__mode = "k"}


Prompt: --[[ Top Level Roblox Services ]]

Response:
--
local PlayersService = game:GetService("Players")
local RunService = game:GetService("RunService")


Prompt:
--// All global vars will be wiped/replaced except script
--// All guis are autonamed using client.Functions.GetRandom()

Response:
return function(data)
	local gui = client.UI.Prepare(script.Parent.Parent)
	local playergui = service.PlayerGui

	local frame = gui.Drag.Frame
	local close = gui.Drag.Frame.Close
	local main = gui.Drag.Frame.Main
	local ques = gui.Drag.Frame.Main.Question
	local ans = gui.Drag.Frame.Main.Answers
	local entry = gui.Entry

	local question = data.Question
	local answers = data.Answers

	local selected

	ques.Text = question

	close.MouseButton1Click:connect(function()
		gui:Destroy()
		selected = false
	end)

	local num = 0
	for i,v in pairs(answers) do
		local clone = entry:clone()
		clone.Parent = ans
		clone.Text = v
		clone.Position = UDim2.new(0,0,0,num*20)
		clone.Visible = true
		clone.MouseButton1Click:connect(function()
			gui:Destroy()
			selected = v
		end)
		num=num+1
	end

	gTable:Ready()

	local temp = 0
	repeat wait(0.1) temp=temp+0.1 until temp>60 or selected~=nil

	if gui and gui.Parent then gui:Destroy() end

	return selected
end


Response:
mouse.KeyDown:connect(function (key)
    key = string.lower(key)
		if key == "u" then --Window controls
		 if windows == false then
			winfob.Visible = true
			windows = true
		 else windows = false
			winfob.Visible = false
		 end
		elseif key == "[" then -- volume down
			if carSeat.Parent.Body.MP.Sound.Volume > 0 then
				handler:FireServer('updateVolume', -0.2)
			end
		elseif key == "]" then -- volume up
			if carSeat.Parent.Body.MP.Sound.Volume < 10 then
				handler:FireServer('updateVolume', 0.2)
			end
	end
end)

winfob.mg.Play.MouseButton1Click:connect(function() --Play the next song
	handler:FireServer('updateSong', winfob.mg.Input.Text)
end)

mouse.KeyUp:connect(function (key)
    key = string.lower(key)
	if key:byte() == 48 then --Camera controls
		st = false
	end
end)

HUB2.W.MouseButton1Click:connect(function()
	handler:FireServer('wws',carSeat.WS.Value,st)
	handler:FireServer('wwr',carSeat.WS.Value,st)
end)

HUB2.UpW.MouseButton1Click:connect(function()
	handler:FireServer('wspd',1)
end)

HUB2.DnW.MouseButton1Click:connect(function()
	handler:FireServer('wspd',-1)
end)

HUB2.SS.MouseButton1Click:connect(function()
	carSeat.SST.Value = not carSeat.SST.Value
end)

for i,v in pairs(script.Parent:getChildren()) do
	if v:IsA('TextButton') then
		v.MouseButton1Click:connect(function()
			if carSeat.Windows:FindFirstChild(v.Name) then
				local v = carSeat.Windows:FindFirstChild(v.Name)
				if v.Value == true then
					handler:FireServer('updateWindows', v.Name, false)
				else
					handler:FireServer('updateWindows', v.Name, true)
				end
			end
		end)
	end
end


Prompt:
--[[

	streamable = Streamable.new(parent: Instance, childName: string)

	streamable:Observe(handler: (child: Instance, janitor: Janitor) -> void): Connection
	streamable:Destroy()

--]]

Response:
type StreamableWithInstance = {
	Instance: Instance?,
	[any]: any,
}

local Janitor = require(script.Parent.Janitor)
local Signal = require(script.Parent.Signal)

local Streamable = {}
Streamable.__index = Streamable

function Streamable.new(parent: Instance, childName: string)

	local self: StreamableWithInstance = {}
	setmetatable(self, Streamable)

	self._janitor = Janitor.new()
	self._shown = Signal.new(self._janitor)
	self._shownJanitor = Janitor.new()
	self._janitor:Add(self._shownJanitor)

	self.Instance = parent:FindFirstChild(childName)

	local function OnInstanceSet()
		local instance = self.Instance
		if typeof(instance) == "Instance" then
			self._shown:Fire(instance, self._shownJanitor)
			self._shownJanitor:Add(instance:GetPropertyChangedSignal("Parent"):Connect(function()
				if not instance.Parent then
					self._shownJanitor:Cleanup()
				end
			end))
			self._shownJanitor:Add(function()
				if self.Instance == instance then
					self.Instance = nil
				end
			end)
		end
	end

	local function OnChildAdded(child: Instance)
		if child.Name == childName and not self.Instance then
			self.Instance = child
			OnInstanceSet()
		end
	end

	self._janitor:Add(parent.ChildAdded:Connect(OnChildAdded))
	if self.Instance then
		OnInstanceSet()
	end

	return self

end

function Streamable:Observe(handler)
	if self.Instance then
		task.spawn(handler, self.Instance, self._shownJanitor)
	end
	return self._shown:Connect(handler)
end

function Streamable:Destroy()
	self._janitor:Destroy()
end

local s = Streamable.new(workspace, "X")
export type Streamable = typeof(s)
s:Destroy()

return Streamable


Prompt:
--[=[
	@param object any -- Object to track
	@param cleanupMethod string? -- Optional cleanup name override
	@return object: any
	Adds an object to the Janitor. Once the Janitor is cleaned or
	destroyed, the object will also be cleaned up.

	The object must be any of the following:
	- Roblox instance (e.g. Part)
	- RBXScriptConnection (e.g. `workspace.ChildAdded:Connect(function() end)`)
	- Function
	- Table with either a `Destroy` or `Disconnect` method
	- Table with custom `cleanupMethod` name provided

	Returns the object added.

	```lua
	-- Add a part to the Janitor, then destroy the Janitor,
	-- which will also destroy the part:
	local part = Instance.new("Part")
	Janitor:Add(part)
	Janitor:Destroy()

	-- Add a function to the Janitor:
	Janitor:Add(function()
		print("Cleanup!")
	end)
	Janitor:Destroy()

	-- Standard cleanup from table:
	local tbl = {}
	function tbl:Destroy()
		print("Cleanup")
	end
	Janitor:Add(tbl)

	-- Custom cleanup from table:
	local tbl = {}
	function tbl:DoSomething()
		print("Do something on cleanup")
	end
	Janitor:Add(tbl, "DoSomething")
	```
]=]

Response:
function Janitor:Add(object: any, cleanupMethod: string?): any
	local cleanup = GetObjectCleanupFunction(object, cleanupMethod)
	table.insert(self._objects, {object, cleanup})
	return object
end


Prompt:
--[[
Classes.RadioButtonLabel

This class creates a single radio button label.

Constructors:
	new(frame [instance])
		>
	Create(text)
		> Creates a RadioButtonLabel from the text provided.

Properties:
	Frame [instance]
		> The container frame for the RadioButtonLabel. Can be used for positioning and resizing.
	Button [instance]
 		> The button used to track when the user clicks on the radio button or not

Methods:
	:GetValue() [boolean]
		> Returns whether the button is selected or not.
	:SetValue(bool [boolean]) [void]
		> Sets if the button is selected or not
	:Destroy() [void]
		> Destroys the RadioButtonLabel and all the events, etc that were running it.
--]]


Prompt:
-- WorldSpace -> ScreenSpace. Raw function taking a world position and giving you the
-- screen position.

Response:
function ScreenSpace.WorldToScreen(at)
	local point = Workspace.CurrentCamera.CoordinateFrame:pointToObjectSpace(at)
	local aspectRatio = ScreenSpace.AspectRatio()
	local hfactor = math.tan(math.rad(Workspace.CurrentCamera.FieldOfView)/2)
	local wfactor = aspectRatio*hfactor
	--
	local x = (point.x/point.z) / -wfactor
	local y = (point.y/point.z) /  hfactor
	--
	return Vector2.new(ScreenSpace.ViewSizeX()*(0.5 + 0.5*x), ScreenSpace.ViewSizeY()*(0.5 + 0.5*y))
end


Prompt:
--[[

	LOWGames Studios
	Date: 27 October 2022
	by Elder

]]

Response:
--

local u1 = nil;
coroutine.wrap(function()
	u1 = require(game.ReplicatedStorage:WaitForChild("Framework"):WaitForChild("Library"));
end)();
return function(p1, p2)
	for v1, v2 in ipairs(p1) do
		if v2 == p2 then
			return true;
		end;
	end;
	return false;
end;


Prompt: --This module is meant for functions that are universally used across all FX modules

Response:
local GameFXModule = {}

return GameFXModule


Prompt:
--[[
		___      _______                _
	   / _ |____/ ___/ /  ___ ____ ___ (_)__
	  / __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
	 /_/ |_|   \___/_//_/\_,_/___/___/_/___/
 						SecondLogic @ Inspare
]]

Response:
local FE = workspace.FilteringEnabled
local car = script.Parent.Car.Value
local handler = car:WaitForChild("AC6_FE_Sounds")
local _Tune = require(car["A-Chassis Tune"])
local on = 0
local mult=0
local det=0
local trm=0
local trmmult=0
local trmon=0
local throt=0
local redline=0
local shift=0

script:WaitForChild("Rev")


Prompt: --// Ammo Settings

Response:
	Ammo = 8;
	StoredAmmo = 8;
	MagCount = 900;


Response:
	EngineModule.StartUp = function()
		engine.StartUp:Play()
		for _,s in pairs(Misc:GetChildren()) do
			if s.Name == "Vents" then
				s.Smoke.Enabled = true
			end
		end
		for _,i in pairs(Misc:GetChildren()) do
			if i.Name == "Rotor" and i:FindFirstChild("Motor") ~= nil then
				repeat wait(0.05)
					i.Motor.MaxVelocity = i.Motor.MaxVelocity + 0.005
				until i.Motor.MaxVelocity >= 0.3
			end
		end
		wait(StartUpTime)
		engine.Flying:Play()
		engine.StartUp:Stop()
		for _,e in pairs(Misc:GetChildren()) do
			if e.Name == "Vents" then
				e.Smoke.Enabled = false
			end
		end
	end


Response:
local  Paint = false

script.Parent.MouseButton1Click:connect(function()
	Paint = not Paint
	handler:FireServer("Sunrise",Paint)
end)


Prompt: -- this bit 1 means constant (0 means register)

Response: luaP.BITRK = math.ldexp(1, luaP.SIZE_B - 1)