Prompt: --[[Weld functions]]

Response:
	local JS = game:GetService("JointsService")
	local PGS_ON = workspace:PGSIsEnabled()

	function MakeWeld(x,y,type,s)
		if type==nil then type="Weld" end
		local W=Instance.new(type,JS)
		W.Part0=x W.Part1=y
		W.C0=x.CFrame:inverse()*x.CFrame
		W.C1=y.CFrame:inverse()*x.CFrame
		if type=="Motor" and s~=nil then
			W.MaxVelocity=s
		end
		return W
	end

	function ModelWeld(a,b)
		if a:IsA("BasePart") and
			a.Parent.Name ~= ("Lights") then
			MakeWeld(b,a,"Weld")
		elseif a:IsA("Model") then
			for i,v in pairs(a:GetChildren()) do
				ModelWeld(v,b)
			end
		end
	end

	function UnAnchor(a)
		if a:IsA("BasePart") then a.Anchored=false  end for i,v in pairs(a:GetChildren()) do UnAnchor(v) end
	end


Prompt:
--[=[
	Returns a resolved promise with the following values

	@param ... Values to resolve to
	@return Promise<T>
]=]

Response:
function Promise.resolved(...)
	local n = select("#", ...)
	if n == 0 then
		-- Reuse promise here to save on calls to Promise.resolved()
		return _emptyFulfilledPromise
	elseif n == 1 and Promise.isPromise(...) then
		local promise = (...)

		-- Resolving to promise that is already resolved. Just return the promise!
		if not promise._pendingExecuteList then
			return promise
		end
	end

	local promise = Promise.new()
	promise:Resolve(...)
	return promise
end


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

Response:
local autoscaling	= false					--Estimates top speed

local UNITS	= {								--Click on speed to change units
											--First unit is default
												{
		units			= "KM/H"			,
		scaling			= (10/12) * 1.09728	, -- 1 stud : 10 inches | ft/s to KP/H
		maxSpeed		= 260				,
		spInc			= 40				, -- Increment between labelled notches
	},
	{
		units			= "MPH"				,
		scaling			= (10/12) * (60/88)	, -- 1 stud : 10 inches | ft/s to MPH
		maxSpeed		= 150				,
		spInc			= 20				, -- Increment between labelled notches
	},

	{
		units			= "SPS"				,
		scaling			= 1					, -- Roblox standard
		maxSpeed		= 400				,
		spInc			= 40				, -- Increment between labelled notches
	}
}


Prompt:
--!strict
-- upstream: https://github.com/facebook/react/blob/702fad4b1b48ac8f626ed3f35e8f86f5ea728084/packages/shared/invokeGuardedCallbackImpl.js
--[[*
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow
 ]]
-- local invariant = require(script.Parent.invariant)

Response: local describeError = require(script.Parent["ErrorHandling.roblox"]).describeError


Prompt: -- Fonction pour trouver la source d'eau la plus proche

Response:
local function findNearestWaterSource(position)
	local nearestWaterSource = nil
	local nearestDistance = math.huge

	-- Parcours de toutes les cellules du terrain
	for x = 0, terrain.Size.X, terrain.Resolution do
		for y = 0, terrain.Size.Y, terrain.Resolution do
			local cellPosition = Vector3.new(x, 0, y)

			-- Vérifie si la cellule est de l'eau
			if terrain:GetMaterial(cellPosition) == Enum.Material.Water then
				-- Calcule la distance entre la cellule d'eau et la position actuelle
				local distance = calculateDistance(position, cellPosition)

				-- Vérifie si c'est la source d'eau la plus proche jusqu'à présent
				if distance < nearestDistance then
					nearestDistance = distance
					nearestWaterSource = cellPosition
				end
			end
		end
	end

	return nearestWaterSource
end


Prompt: --[[Drivetrain]]

Response:
	Tune.Config			= "AWD"		--"FWD" , "RWD" , "AWD"

	--Differential Settings
	Tune.FDiffSlipThres	= 0		-- 1 - 100%				(Max threshold of applying full lock determined by deviation from avg speed)
	Tune.FDiffLockThres	= 0			-- 0 - 100%				(0 - Bias toward slower wheel, 100 - Bias toward faster wheel)
	Tune.RDiffSlipThres	= 0		-- 1 - 100%
	Tune.RDiffLockThres	= 0			-- 0 - 100%
	Tune.CDiffSlipThres	= 0			-- 1 - 100%				[AWD Only]
	Tune.CDiffLockThres	= 0			-- 0 - 100%				[AWD Only]

	--Traction Control Settings
	Tune.TCSEnabled		= false		-- Implements TCS
	Tune.TCSThreshold	= 20		-- Slip speed allowed before TCS starts working (in SPS)
	Tune.TCSGradient	= 20		-- Slip speed gradient between 0 to max reduction (in SPS)
	Tune.TCSLimit		= 20		-- Minimum amount of torque at max reduction (in percent)


Prompt:
--[=[
	Iterates serially over the given an array of values, calling the predicate callback on each value before continuing.

	If the predicate returns a Promise, we wait for that Promise to resolve before moving on to the next item
	in the array.

	:::info
	`Promise.each` is similar to `Promise.all`, except the Promises are ran in order instead of all at once.

	But because Promises are eager, by the time they are created, they're already running. Thus, we need a way to defer creation of each Promise until a later time.

	The predicate function exists as a way for us to operate on our data instead of creating a new closure for each Promise. If you would prefer, you can pass in an array of functions, and in the predicate, call the function and return its return value.
	:::

	```lua
	Promise.each({
		"foo",
		"bar",
		"baz",
		"qux"
	}, function(value, index)
		return Promise.delay(1):andThen(function()
		print(("%d) Got %s!"):format(index, value))
		end)
	end)

	--[[
		(1 second passes)
		> 1) Got foo!
		(1 second passes)
		> 2) Got bar!
		(1 second passes)
		> 3) Got baz!
		(1 second passes)
		> 4) Got qux!
	]]
	```

	If the Promise a predicate returns rejects, the Promise from `Promise.each` is also rejected with the same value.

	If the array of values contains a Promise, when we get to that point in the list, we wait for the Promise to resolve before calling the predicate with the value.

	If a Promise in the array of values is already Rejected when `Promise.each` is called, `Promise.each` rejects with that value immediately (the predicate callback will never be called even once). If a Promise in the list is already Cancelled when `Promise.each` is called, `Promise.each` rejects with `Promise.Error(Promise.Error.Kind.AlreadyCancelled`). If a Promise in the array of values is Started at first, but later rejects, `Promise.each` will reject with that value and iteration will not continue once iteration encounters that value.

	Returns a Promise containing an array of the returned/resolved values from the predicate for each item in the array of values.

	If this Promise returned from `Promise.each` rejects or is cancelled for any reason, the following are true:
	- Iteration will not continue.
	- Any Promises within the array of values will now be cancelled if they have no other consumers.
	- The Promise returned from the currently active predicate will be cancelled if it hasn't resolved yet.

	@since 3.0.0
	@param list {T | Promise<T>}
	@param predicate (value: T, index: number) -> U | Promise<U>
	@return Promise<{U}>
]=]

Response:
function Promise.each(list, predicate)
	assert(type(list) == "table", string.format(ERROR_NON_LIST, "Promise.each"))
	assert(type(predicate) == "function", string.format(ERROR_NON_FUNCTION, "Promise.each"))

	return Promise._new(debug.traceback(nil, 2), function(resolve, reject, onCancel)
		local results = {}
		local promisesToCancel = {}

		local cancelled = false

		local function cancel()
			for _, promiseToCancel in ipairs(promisesToCancel) do
				promiseToCancel:cancel()
			end
		end

		onCancel(function()
			cancelled = true

			cancel()
		end)

		-- We need to preprocess the list of values and look for Promises.
		-- If we find some, we must register our andThen calls now, so that those Promises have a consumer
		-- from us registered. If we don't do this, those Promises might get cancelled by something else
		-- before we get to them in the series because it's not possible to tell that we plan to use it
		-- unless we indicate it here.

		local preprocessedList = {}

		for index, value in ipairs(list) do
			if Promise.is(value) then
				if value:getStatus() == Promise.Status.Cancelled then
					cancel()
					return reject(Error.new({
						error = "Promise is cancelled",
						kind = Error.Kind.AlreadyCancelled,
						context = string.format(
							"The Promise that was part of the array at index %d passed into Promise.each was already cancelled when Promise.each began.\n\nThat Promise was created at:\n\n%s",
							index,
							value._source
						),
					}))
				elseif value:getStatus() == Promise.Status.Rejected then
					cancel()
					return reject(select(2, value:await()))
				end

				-- Chain a new Promise from this one so we only cancel ours
				local ourPromise = value:andThen(function(...)
					return ...
				end)

				table.insert(promisesToCancel, ourPromise)
				preprocessedList[index] = ourPromise
			else
				preprocessedList[index] = value
			end
		end

		for index, value in ipairs(preprocessedList) do
			if Promise.is(value) then
				local success
				success, value = value:await()

				if not success then
					cancel()
					return reject(value)
				end
			end

			if cancelled then
				return
			end

			local predicatePromise = Promise.resolve(predicate(value, index))

			table.insert(promisesToCancel, predicatePromise)

			local success, result = predicatePromise:await()

			if not success then
				cancel()
				return reject(result)
			end

			results[index] = result
		end

		resolve(results)
	end)
end


Prompt: -- Define target box cleanup routine

Response:
function TargetBoxPool.Cleanup(TargetBox)
	TargetBox.Adornee = nil
	TargetBox.Visible = nil
end

function TargetingModule.HighlightTarget(Target)

	-- Clear previous target boxes
	TargetBoxPool:ReleaseAll()

	-- Make sure target exists
	if not Target then
		return
	end

	-- Get targetable items
	local Items = Support.FlipTable { Target }
	if not IsVisible(Target) then
		Items = Support.FlipTable(GetVisibleChildren(Target))
	end

	-- Focus target boxes on target
	for Target in pairs(Items) do
		local TargetBox = TargetBoxPool:Get()
		TargetBox.Adornee = Target
		TargetBox.Visible = true
	end

end;

local function IsAncestorSelected(Item)
	while Item and (Item ~= TargetingModule.Scope) do
		if Selection.IsSelected(Item) then
			return true
		else
			Item = Item.Parent
		end
	end
end

function TargetingModule.SelectTarget(Force)
	local Scope = TargetingModule.Scope

	-- Update target
	local Target, ScopeTarget = TargetingModule:UpdateTarget(Scope, true)

	-- Ensure target selection isn't cancelled
	if not Force and SelectionCancelled then
		SelectionCancelled = false;
		return;
	end;

	-- Focus on clicked, selected item
	if not Selection.Multiselecting and (Selection.IsSelected(ScopeTarget) or IsAncestorSelected(ScopeTarget)) then
		Selection.SetFocus(ScopeTarget)
		return;
	end;

	-- Clear selection if invalid target selected
	if not GetCore().IsSelectable({ Target }) then
		Selection.Clear(true);
		return;
	end;

	-- Unselect clicked, selected item if multiselection is enabled
	if Selection.Multiselecting and Selection.IsSelected(ScopeTarget) then
		Selection.Remove({ ScopeTarget }, true)
		return
	end

	-- Add to selection if multiselecting
	if Selection.Multiselecting then
		Selection.Add({ ScopeTarget }, true)
		Selection.SetFocus(ScopeTarget)

	-- Replace selection if not multiselecting
	else
		Selection.Replace({ ScopeTarget }, true)
		Selection.SetFocus(ScopeTarget)
	end

end;

function TargetingModule.SelectSiblings(Part, ReplaceSelection)
	-- Selects all parts under the same parent as `Part`

	-- If a part is not specified, assume the currently focused part
	local Part = Part or Selection.Focus;

	-- Ensure the part exists and its parent is not Workspace
	if not Part or Part.Parent == TargetingModule.Scope then
		return;
	end;

	-- Get the focused item's siblings
	local Siblings = Support.GetDescendantsWhichAreA(Part.Parent, 'BasePart')

	-- Ensure items are selectable
	if not GetCore().IsSelectable(Siblings) then
		return
	end

	-- Add to or replace selection
	if ReplaceSelection then
		Selection.Replace(Siblings, true);
	else
		Selection.Add(Siblings, true);
	end;

end;

function TargetingModule.StartRectangleSelecting()

	-- Ensure selection isn't cancelled
	if SelectionCancelled then
		return;
	end;

	-- Mark where rectangle selection started
	RectangleSelectStart = Vector2.new(Mouse.X, Mouse.Y);

	-- Track mouse while rectangle selecting
	GetCore().Connections.WatchRectangleSelection = Mouse.Move:Connect(function ()

		-- If rectangle selecting, update rectangle
		if RectangleSelecting then
			TargetingModule.UpdateSelectionRectangle();

		-- Watch for potential rectangle selections
		elseif RectangleSelectStart and (Vector2.new(Mouse.X, Mouse.Y) - RectangleSelectStart).magnitude >= 10 then
			RectangleSelecting = true;
			SelectionCancelled = true;
		end;

	end);

end;

function TargetingModule.UpdateSelectionRectangle()

	-- Ensure rectangle selection is ongoing
	if not RectangleSelecting then
		return;
	end;

	-- Get core API
	local Core = GetCore();

	-- Create selection rectangle
	if not SelectionRectangle then
		SelectionRectangle = Make 'Frame' {
			Name = 'SelectionRectangle',
			Parent = Core.UI,
			BackgroundColor3 = Color3.fromRGB(100, 100, 100),
			BorderColor3 = Color3.new(0, 0, 0),
			BackgroundTransparency = 0.5,
			BorderSizePixel = 1
		};
	end;

	local StartPoint = Vector2.new(
		math.min(RectangleSelectStart.X, Mouse.X),
		math.min(RectangleSelectStart.Y, Mouse.Y)
	);
	local EndPoint = Vector2.new(
		math.max(RectangleSelectStart.X, Mouse.X),
		math.max(RectangleSelectStart.Y, Mouse.Y)
	);

	-- Update size and position
	SelectionRectangle.Parent = Core.UI;
	SelectionRectangle.Position = UDim2.new(0, StartPoint.X, 0, StartPoint.Y);
	SelectionRectangle.Size = UDim2.new(0, EndPoint.X - StartPoint.X, 0, EndPoint.Y - StartPoint.Y);

end;

function TargetingModule.CancelRectangleSelecting()

	-- Prevent potential rectangle selections
	RectangleSelectStart = nil;

	-- Clear ongoing rectangle selection
	RectangleSelecting = false;

	-- Clear rectangle selection watcher
	local Connections = GetCore().Connections;
	if Connections.WatchRectangleSelection then
		Connections.WatchRectangleSelection:Disconnect();
		Connections.WatchRectangleSelection = nil;
	end;

	-- Clear rectangle UI
	if SelectionRectangle then
		SelectionRectangle.Parent = nil;
	end;

end;

function TargetingModule.CancelSelecting()
	SelectionCancelled = true;
	TargetingModule.CancelRectangleSelecting();
end;

function TargetingModule.FinishRectangleSelecting()
	local Core = GetCore()

	local RectangleSelecting = RectangleSelecting;
	local RectangleSelectStart = RectangleSelectStart;

	-- Clear rectangle selection
	TargetingModule.CancelRectangleSelecting();

	-- Ensure rectangle selection is ongoing
	if not RectangleSelecting then
		return;
	end;

	-- Ensure a targeting scope is set
	if not TargetingModule.Scope then
		return
	end

	-- Get rectangle dimensions
	local StartPoint = Vector2.new(
		math.min(RectangleSelectStart.X, Mouse.X),
		math.min(RectangleSelectStart.Y, Mouse.Y)
	);
	local EndPoint = Vector2.new(
		math.max(RectangleSelectStart.X, Mouse.X),
		math.max(RectangleSelectStart.Y, Mouse.Y)
	);

	local SelectableItems = {};

	-- Find items that lie within the rectangle
	local ScopeParts = Support.GetDescendantsWhichAreA(TargetingModule.Scope, 'BasePart')
	for _, Part in pairs(ScopeParts) do
		local ScreenPoint, OnScreen = Workspace.CurrentCamera:WorldToScreenPoint(Part.Position)
		if OnScreen then
			local LeftCheck = ScreenPoint.X >= StartPoint.X
			local RightCheck = ScreenPoint.X <= EndPoint.X
			local TopCheck = ScreenPoint.Y >= StartPoint.Y
			local BottomCheck = ScreenPoint.Y <= EndPoint.Y
			if (LeftCheck and RightCheck and TopCheck and BottomCheck) and Core.IsSelectable({ Part }) then
				local ScopeTarget = TargetingModule:FindTargetInScope(Part, TargetingModule.Scope)
				SelectableItems[ScopeTarget] = true
			end
		end
	end

	-- Add to selection if multiselecting
	if Selection.Multiselecting then
		Selection.Add(Support.Keys(SelectableItems), true)

	-- Replace selection if not multiselecting
	else
		Selection.Replace(Support.Keys(SelectableItems), true)
	end;

end;

function TargetingModule.PrismSelect()
	-- Selects parts in the currently selected parts

	-- Ensure parts are selected
	if #Selection.Items == 0 then
		return;
	end;

	-- Get core API
	local Core = GetCore();

	-- Get region for selection items and find potential parts
	local Extents = require(Core.Tool.Core.BoundingBox).CalculateExtents(Selection.Items, nil, true);
	local Region = Region3.new(Extents.Min, Extents.Max);
	local PotentialParts = Workspace:FindPartsInRegion3WithIgnoreList(Region, Selection.Items, math.huge);

	-- Enable collision on all potential parts
	local OriginalState = {};
	for _, PotentialPart in pairs(PotentialParts) do
		OriginalState[PotentialPart] = { Anchored = PotentialPart.Anchored, CanCollide = PotentialPart.CanCollide };
		PotentialPart.Anchored = true;
		PotentialPart.CanCollide = true;
	end;

	local Parts = {};

	-- Find all parts intersecting with selection
	for _, Part in pairs(Selection.Items) do
		local TouchingParts = Part:GetTouchingParts();
		for _, TouchingPart in pairs(TouchingParts) do
			if not Selection.IsSelected(TouchingPart) then
				Parts[TouchingPart] = true;
			end;
		end;
	end;

	-- Restore all potential parts' original states
	for PotentialPart, State in pairs(OriginalState) do
		PotentialPart.CanCollide = State.CanCollide;
		PotentialPart.Anchored = State.Anchored;
	end;

	-- Delete the selection parts
	Core.DeleteSelection();

	-- Select all found parts
	Selection.Replace(Support.Keys(Parts), true);

end;

function TargetingModule:EnableScopeSelection()
	-- Enables the scope selection interface

	-- Set up state
	local Scoping = false
	local InitialScope = nil

	local function HandleScopeInput(Action, State, Input)
		if State.Name == 'Begin' then
			local IsAltPressed = UserInputService:IsKeyDown 'LeftAlt' or
				UserInputService:IsKeyDown 'RightAlt'
			local IsShiftPressed = UserInputService:IsKeyDown 'LeftShift' or
				UserInputService:IsKeyDown 'RightShift'

			-- If Alt is pressed, begin scoping
			if (not Scoping) and (Input.KeyCode.Name:match 'Alt') then
				Scoping = self.Scope
				InitialScope = self.Scope

				-- Set new scope to current scope target
				local Target, ScopeTarget = self:UpdateTarget(self.Scope, true)
				if Target ~= ScopeTarget then
					self:SetScope(ScopeTarget or self.Scope)
					self:UpdateTarget(self.Scope, true)
					self.IsScopeLocked = false
					self.ScopeLockChanged:Fire(false)
					Scoping = self.Scope
				end

			-- If Alt-Shift-Z is pressed, exit current scope
			elseif Scoping and IsAltPressed and IsShiftPressed and (Input.KeyCode.Name == 'Z') then
				local NewScope = self.Scope.Parent or InitialScope
				if GetCore().Security.IsLocationAllowed(NewScope, GetCore().Player) then
					self:SetScope(NewScope)
					self:UpdateTarget(self.Scope, true)
					self.IsScopeLocked = false
					self.ScopeLockChanged:Fire(false)
					Scoping = self.Scope
				end
				return Enum.ContextActionResult.Sink

			-- If Alt-Z is pressed, enter scope of current target
			elseif Scoping and IsAltPressed and (Input.KeyCode.Name == 'Z') then
				local Target, ScopeTarget = self:UpdateTarget(self.Scope, true)
				if Target ~= ScopeTarget then
					self:SetScope(ScopeTarget or self.Scope)
					self:UpdateTarget(self.Scope, true)
					self.IsScopeLocked = false
					self.ScopeLockChanged:Fire(false)
					Scoping = self.Scope
				end
				return Enum.ContextActionResult.Sink

			-- If Alt-F is pressed, stay in current scope
			elseif Scoping and IsAltPressed and (Input.KeyCode.Name == 'F') then
				Scoping = true
				self.IsScopeLocked = true
				self.ScopeLockChanged:Fire(true)
				return Enum.ContextActionResult.Sink
			end

		-- Disable scoping on Alt release
		elseif State.Name == 'End' then
			if Scoping and (Input.KeyCode.Name:match 'Alt') then
				if self.Scope == Scoping then
					self:SetScope(InitialScope)
					self.IsScopeLocked = true
					self.ScopeLockChanged:Fire(true)
				end
				self:UpdateTarget(self.Scope, true)
				Scoping = nil
				InitialScope = nil
			end
		end

		-- If window focus changes, reset and disable scoping
		if Scoping and Input.UserInputType.Name == 'Focus' then
			if self.Scope == Scoping then
				self:SetScope(InitialScope)
				self.IsScopeLocked = true
				self.ScopeLockChanged:Fire(true)
			end
			self:UpdateTarget(self.Scope, true)
			Scoping = nil
			InitialScope = nil
		end

		-- Pass all non-sunken input to next handler
		return Enum.ContextActionResult.Pass
	end

	-- Enable scoping interface
	ContextActionService:BindAction('BT: Scope', HandleScopeInput, false,
		Enum.KeyCode.LeftAlt,
		Enum.KeyCode.RightAlt,
		Enum.KeyCode.Z,
		Enum.KeyCode.F,
		Enum.UserInputType.Focus
	)

	-- Disable scoping interface when tool disables
	GetCore().Disabling:Connect(function ()
		ContextActionService:UnbindAction('BT: Scope')
	end)

end

function TargetingModule:EnableScopeAutoReset()
	-- Enables automatic scope resetting (when scope becomes invalid)

	local LastScopeListener, LastScopeAncestry

	-- Listen to changes in scope
	GetCore().UIMaid.ScopeReset = self.ScopeChanged:Connect(function (Scope)

		-- Clear last scope listener
		LastScopeListener = LastScopeListener and LastScopeListener:Disconnect()

		-- Only listen to new scope if defined
		if not Scope then
			return
		end

		-- Capture new scope's ancestry
		LastScopeAncestry = {}
		local Ancestor = Scope.Parent
		while Ancestor:IsDescendantOf(Workspace) do
			table.insert(LastScopeAncestry, Ancestor)
			Ancestor = Ancestor.Parent
		end

		-- Reset scope when scope is gone
		LastScopeListener = Scope.AncestryChanged:Connect(function (_, Parent)
			if Parent == nil then

				-- Get next parent in ancestry
				local NextScopeInAncestry
				if LastScopeAncestry then
					for _, Parent in ipairs(LastScopeAncestry) do
						if Parent:IsDescendantOf(Workspace) then
							NextScopeInAncestry = Parent
							break
						end
					end
				end

				-- Set next scope
				if NextScopeInAncestry then
					self:SetScope(NextScopeInAncestry)
				else
					self:SetScope(Workspace, true)
				end

			-- Capture scope ancestry when it changes
			else
				LastScopeAncestry = {}
				local Ancestor = Scope.Parent
				while Ancestor:IsDescendantOf(Workspace) do
					table.insert(LastScopeAncestry, Ancestor)
					Ancestor = Ancestor.Parent
				end
			end
		end)

	end)
end


Prompt: --> FUNCTIONS

Response:
local function ButtonPress(Button)
	local Sound = script.Click:Clone()
	Sound.Parent = Button
	Sound:Play()
	Button.Size = Vector3.new(0.8, 0.8, .01)
	wait(.2)
	Button.Size = Vector3.new(0.8, 0.8, 0.1)
	Sound:Destroy()
end

local function Clear()
	Text.Text = ""
	EnteredText.Value = Text.Text
end

for i, v in pairs(Board:WaitForChild("Numbers"):getChildren()) do
	v.ClickDetector.MouseClick:Connect(function()
		ButtonPress(v)
		if string.len(Text.Text) < string.len(Code) then
			Text.Text = Text.Text..v.Name
			EnteredText.Value = Text.Text
		else
			Text.Text = v.Name
			EnteredText.Value = Text.Text
		end
	end)
end

OtherButtons.Enter.ClickDetector.MouseClick:Connect(function()
	ButtonPress(OtherButtons.Enter)
	if EnteredText.Value == Code then
		OtherButtons.Enter.Approved:Play()
		Clear()
		for count = 1, 10 do
			Door.Door.Transparency = Door.Door.Transparency + .1
			wait()
		end
		Door.Door.CanCollide = false
		wait(3)
		Door.Door.CanCollide = true
		for count = 1, 10 do
			Door.Door.Transparency = Door.Door.Transparency - .1
			wait()
		end
	else
		OtherButtons.Enter.Denied:Play()
		Clear()
	end
end)

OtherButtons.Clear.ClickDetector.MouseClick:Connect(function()
	ButtonPress(OtherButtons.Clear)
	Clear()
end)


Prompt:
--[=[
	Hides the pane
	@param doNotAnimate boolean? -- True if this visiblity should not animate
]=]

Response:
function BasicPane:Hide(doNotAnimate)
	self:SetVisible(false, doNotAnimate)
end


Prompt: --//Controller//--

Response:
Holder.ChildAdded:Connect(function(Donation)
	if Donation:IsA("Frame") then
		local Button = Donation.Button

		Button.MouseButton1Click:Connect(function()
			local ProductInfo = MPS:PromptProductPurchase(Player, Button:GetAttribute("ID"))

		end)
	end
end)


Prompt:
--[[
	_table_listeners structure:

		_table_listeners = {
			[1] = {
				["key_of_table"] = {
					[1] = {["key_of_table"] = {...}, ...},
					[2] = {listener, ...} / nil, -- Change
					[3] = {listener, ...} / nil, -- NewKey
					[4] = {listener, ...} / nil, -- ArrayInsert
					[5] = {listener, ...} / nil, -- ArraySet
					[6] = {listener, ...} / nil, -- ArrayRemove
				},
			},
			[2] = {listener, ...} / nil, -- Change
			[3] = {listener, ...} / nil, -- NewKey
			[4] = {listener, ...} / nil, -- ArrayInsert
			[5] = {listener, ...} / nil, -- ArraySet
			[6] = {listener, ...} / nil, -- ArrayRemove
		}

	_function_listeners structure:

		_function_listeners = {
			[func_id] = {
				listening_function, ...
			},
			...
		}
--]]


Prompt: --		print(animName .. " " .. idx .. " [" .. origRoll .. "]")

Response:
		local anim = animTable[animName][idx].anim

		-- load it to the humanoid; get AnimationTrack
		currentAnimTrack = humanoid:LoadAnimation(anim)

		-- play the animation
		currentAnimTrack:Play(transitionTime)
		currentAnim = animName

		-- set up keyframe name triggers
		if (currentAnimKeyframeHandler ~= nil) then
			currentAnimKeyframeHandler:disconnect()
		end
		currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
	end
end


Prompt: --create tables:

Response:
for i,part in pairs(model:GetChildren()) do
	if (string.sub(part.Name, 1,1) == "a" or string.sub(part.Name, 1,1) == "c") and part:IsA("BasePart") then
		table.insert(a, 1, part)
	end
end
for i,part in pairs(model:GetChildren()) do
	if (string.sub(part.Name, 1,1) == "b" or string.sub(part.Name, 1,1) == "c") and part:IsA("BasePart") then
		table.insert(b, 1, part)
	end
end

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

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

function run()
	while on do
		lightOn(a)
		wait(0.18)

		lightOff(a)
		wait(0.04)

		lightOn(a)
		wait(0.13)

		lightOff(a)
		wait(0.03)

		lightOn(b)
		wait(0.18)

		lightOff(b)
		wait(0.04)

		lightOn(b)
		wait(0.13)

		lightOff(b)
		wait(0.03)
	end
end

script.Parent.RemoteEvent.OnServerEvent:Connect(function()
	if on == true then
		on = false
	else
		on = true
		run()
	end
end)


Prompt:
--!strict
--[=[
  @function copyDeep
  @within Dictionary

  @param dictionary T -- The dictionary to copy.
  @return T -- The copied dictionary.

  Copies a dictionary recursively.

  ```lua
  local dictionary = { hello = { world = "goodbye" } }

  local new = CopyDeep(dictionary) -- { hello = { world = "goodbye" } }

  print(new == dictionary) -- false
  print(new.hello == dictionary.hello) -- false
  ```
]=]

Response:
local function copyDeep<T>(dictionary: T): T
	local new = {}

	for key, value in pairs(dictionary) do
		if type(value) == "table" then
			new[key] = copyDeep(value)
		else
			new[key] = value
		end
	end

	return new
end

return copyDeep


Prompt: --This will be parented to a player

Response:
local Mouse = game:GetService("Players").LocalPlayer:GetMouse()
local Pressed = script:WaitForChild("Pressed")

Mouse.KeyDown:connect(function (Key)
	if Key == "e" then
		local Target = Mouse.Target
		Pressed:FireServer(Target)
	end
end)


Prompt: --[[Susupension]]

Response:
	Tune.SusEnabled		= true		-- works only in with PGSPhysicsSolverEnabled, defaults to false when PGS is disabled

	--Front Suspension
	Tune.FSusDamping	= 500		-- Spring Dampening
	Tune.FSusStiffness	= 9000		-- Spring Force
	Tune.FAntiRoll 		= 50		-- Anti-Roll (Gyro Dampening)

	Tune.FSusLength		= 2			-- Suspension length (in studs)
	Tune.FPreCompress	= .3		-- Pre-compression adds resting length force
	Tune.FExtensionLim	= .5		-- Max Extension Travel (in studs)
	Tune.FCompressLim	= .1		-- Max Compression Travel (in studs)
	Tune.FSusAngle		= 80		-- Suspension Angle (degrees from horizontal)

	Tune.FWsBoneLen		= 5			-- Wishbone Length
	Tune.FWsBoneAngle	= 0			-- Wishbone angle (degrees from horizontal)
	Tune.FAnchorOffset	= {			-- Suspension anchor point offset (relative to center of wheel)
	 --[[Lateral]]		-.4		,	-- positive = outward
	 --[[Vertical]]		-.5		,	-- positive = upward
	 --[[Forward]]		0		}	-- positive = forward

	--Rear Suspension
	Tune.RSusDamping	= 500		-- Spring Dampening
	Tune.RSusStiffness	= 9000		-- Spring Force
	Tune.FAntiRoll 		= 50		-- Anti-Roll (Gyro Dampening)

	Tune.RSusLength		= 2.7			-- Suspension length (in studs)
	Tune.RPreCompress	= .4		-- Pre-compression adds resting length force
	Tune.RExtensionLim	= .5		-- Max Extension Travel (in studs)
	Tune.RCompressLim	= .2		-- Max Compression Travel (in studs)
	Tune.RSusAngle		= 80		-- Suspension Angle (degrees from horizontal)

	Tune.RWsBoneLen		= 5			-- Wishbone Length
	Tune.RWsBoneAngle	= 0			-- Wishbone angle (degrees from horizontal)
	Tune.RAnchorOffset	= {			-- Suspension anchor point offset (relative to center of wheel)
	 --[[Lateral]]		-.4		,	-- positive = outward
	 --[[Vertical]]		-.5		,	-- positive = upward
	 --[[Forward]]		0		}	-- positive = forward

	--Aesthetics
	Tune.SusVisible		= false			-- Spring Visible
	Tune.WsBVisible		= false			-- Wishbone Visible
	Tune.SusRadius		= .2			-- Suspension Coil Radius
	Tune.SusThickness	= .1			-- Suspension Coil Thickness
	Tune.SusColor		= "Bright red"	-- Suspension Color [BrickColor]
	Tune.SusCoilCount	= 6				-- Suspension Coil Count
	Tune.WsColor		= "Black"		-- Wishbone Color [BrickColor]
	Tune.WsThickness	= .1			-- Wishbone Rod Thickness


Prompt: --Values--

Response:
local Drain = script.Parent.Values.Drain

stat = Player:WaitForChild("Data")

RS.Heartbeat:Connect(function(Time)
	if State:GetState() == "boost" then
		ElapsedTime = ElapsedTime + Time
		if math.clamp(ElapsedTime, 0.3, 0.8) > 0.3 then
			ElapsedTime = 0
			stat.BoostGauge.Value = stat.BoostGauge.Value - Drain.Value
		end
	else
		ElapsedTime = 0
	end
end)


Prompt: -- GLOBALS

Response:
export type Map<K, V> = {[K]: V}

export type Array<V> = {V}


Prompt: --set suitcase name to the player's name

Response:
handle.BottomGui.OwnerName.Text = player.Name
handle.TopGui.OwnerName.Text = player.Name
script.Parent.PlayerName.Value = player.Name


Prompt: -- Important parts --

Response:
local faucet = p.Faucet
local steam = p:WaitForChild("Steam")


Response:
mouse.KeyDown:connect(function (key)
    key = string.lower(key)
		if key == "k" then --Camera controls
	        if cam == ("car") then
				Camera.CameraSubject = player.Character.Humanoid
				Camera.CameraType = ("Custom")
				cam = ("freeplr")
				Camera.FieldOfView = 70
			elseif cam == ("freeplr") then
				Camera.CameraSubject = player.Character.Humanoid
				Camera.CameraType = ("Attach")
				cam = ("lockplr")
				Camera.FieldOfView = 45
	        elseif cam == ("lockplr") then
				Camera.CameraSubject = carSeat
				Camera.CameraType = ("Custom")
				cam = ("car")
				Camera.FieldOfView = 70
	        end
		elseif key == "[" then -- volume down
			if carSeat.Parent.Body.MP.Sound.Volume >= 0 then
				handler:FireServer('volumedown', true)
				carSeat.Parent.Body.Dash.Screen.G.Main.Icon.Vol.Text = ("Vol: "..carSeat.Parent.Body.MP.Sound.Volume)
			end
		elseif key == "]" then -- volume up
			if carSeat.Parent.Body.MP.Sound.Volume <= 10 then
				handler:FireServer('volumeup', true)
				carSeat.Parent.Body.Dash.Screen.G.Main.Icon.Vol.Text = ("Vol: "..carSeat.Parent.Body.MP.Sound.Volume)
			end
		elseif key == "j" then -- volume up
			if scr == false then
				scr = true
				script.Parent.Infotainment:TweenPosition(UDim2.new(0.7, 0, 0.3, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,.6,true)
			else scr = false
				script.Parent.Infotainment:TweenPosition(UDim2.new(1, 0, 0.3, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,.6,true)
			end
	end
end)

HUB2.Limiter.MouseButton1Click:connect(function() --Ignition
	 if carSeat.IsOn.Value == false then
		carSeat.IsOn.Value = true
		carSeat.Startup:Play()
		wait(1)
		carSeat.Chime:Play()
	else
		carSeat.IsOn.Value = false
	end
end)

HUB.Eco.MouseButton1Click:connect(function() --Hide tracker names
	handler:FireServer('Eco')
end)

HUB.Comfort.MouseButton1Click:connect(function() --Hide tracker names
	handler:FireServer('Comfort')
end)

HUB.Sport.MouseButton1Click:connect(function() --Hide tracker names
	handler:FireServer('Sport')
end)

winfob.mg.Play.MouseButton1Click:connect(function() --Play the next song
	handler:FireServer('updateSong', winfob.mg.Input.Text)
	carSeat.Parent.Body.Dash.Screen.G.Main.Icon.ID.Text = (winfob.mg.Input.Text)
end)

winfob.mg.Stop.MouseButton1Click:connect(function() --Play the next song
	handler:FireServer('pauseSong')
	carSeat.Parent.Body.Dash.Screen.G.Main.Icon.ID.Text = ""
end)

carSeat.Indicator.Changed:connect(function()
	if carSeat.Indicator.Value == true then
		script.Parent.Indicator:Play()
	else
		script.Parent.Indicator2:Play()
	end
end)

game.Lighting.Changed:connect(function(prop)
	if prop == "TimeOfDay" then
	handler:FireServer('TimeUpdate')
	end
end)

if game.Workspace.FilteringEnabled == true then
	handler:FireServer('feON')
elseif game.Workspace.FilteringEnabled == false then
	handler:FireServer('feOFF')
end

carSeat.LI.Changed:connect(function()
	if carSeat.LI.Value == true then
		carSeat.Parent.Body.Dash.DashSc.G.Left.Visible = true
		script.Parent.HUB.Left.Visible = true
	else
		carSeat.Parent.Body.Dash.DashSc.G.Left.Visible = false
		script.Parent.HUB.Left.Visible = false
	end
end)

carSeat.RI.Changed:connect(function()
	if carSeat.RI.Value == true then
		carSeat.Parent.Body.Dash.DashSc.G.Right.Visible = true
		script.Parent.HUB.Right.Visible = true
	else
		carSeat.Parent.Body.Dash.DashSc.G.Right.Visible = false
		script.Parent.HUB.Right.Visible = false
	end
end)

for i,v in pairs(script.Parent:getChildren()) do
	if v:IsA('ImageButton') 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

while wait() do
	carSeat.Parent.Body.Dash.DashSc.G.Speed.Text = (math.floor(carSeat.Velocity.magnitude*((10/12) * (60/88))))
	carSeat.Parent.Body.Dash.DashSc.G.Time.Text = game.Lighting.TimeOfDay
end


Prompt: -- Libraries

Response:
local Libraries = Tool:WaitForChild 'Libraries'
local Signal = require(Libraries:WaitForChild 'Signal')
local Make = require(Libraries:WaitForChild 'Make')
local ListenForManualWindowTrigger = require(Tool.Core:WaitForChild('ListenForManualWindowTrigger'))


Prompt: --//Toggle//--

Response:
Button.MouseButton1Click:Connect(function()
	if EmotesMenu.Visible == false then
		EmotesMenu.Visible = true

	else
		EmotesMenu.Visible = false
	end
end)


Prompt: -- Decompiled with the Synapse X Luau decompiler.

Response:
local l__LocalPlayer__1 = game.Players.LocalPlayer;
local u1 = require(game:GetService("ReplicatedStorage"):WaitForChild("Achievements"));
local u2 = script:FindFirstAncestor("MainUI");
local l__TweenService__3 = game:GetService("TweenService");
return function(p1, p2)
	local v2 = u1[p2];
	if v2 then
		local v3 = u2.AchievementsHolder.Achievement:Clone();
		v3.Size = UDim2.new(0, 0, 0, 0);
		v3.Frame.Position = UDim2.new(1.1, 0, 0, 0);
		v3.Name = "LiveAchievement";
		v3.Visible = true;
		for v4, v5 in pairs(v2) do
			local v6 = v3.Frame.Details:FindFirstChild(v4);
			if v6 then
				v6.Text = v5;
			end;
		end;
		if v2.Image then
			v3.Frame.ImageLabel.Image = v2.Image;
		elseif v2.BadgeId then
			v3.Frame.ImageLabel.Image = "rbxassetid://" .. game.BadgeService:GetBadgeInfoAsync(v2.BadgeId).IconImageId;
		end;
		v3.Parent = u2.AchievementsHolder;
		v3.Sound:Play();
		v3:TweenSize(UDim2.new(1, 0, 0.2, 0), "In", "Quad", 0.8, true);
		wait(0.8);
		v3.Frame:TweenPosition(UDim2.new(0, 0, 0, 0), "Out", "Quad", 0.5, true);
		l__TweenService__3:Create(v3.Frame.Glow, TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.In), {
			ImageTransparency = 1
		}):Play();
		wait(8);
		v3.Frame:TweenPosition(UDim2.new(1.1, 0, 0, 0), "In", "Quad", 0.5, true);
		wait(0.5);
		v3:TweenSize(UDim2.new(1, 0, -0.1, 0), "InOut", "Quad", 0.5, true);
		wait(0.5);
		v3:Destroy();
	end;
end;


Prompt: ---[[ Fade Out and In Settings ]]

Response:
module.ChatWindowBackgroundFadeOutTime = 3.5 --Chat background will fade out after this many seconds.
module.ChatWindowTextFadeOutTime = 1 --Chat text will fade out after this many seconds.
module.ChatDefaultFadeDuration = 0.8
module.ChatShouldFadeInFromNewInformation = false
module.ChatAnimationFPS = 20.0


Prompt:
--[[

	Deep compares a table for any changes. Returns false if tables are different.

	Functions.CompareTable(
		table,					<-- |REQ| 	Table/dictionary
		table2,					<-- |REQ| 	Table/dictionary
	)

--]]


Prompt: --Return the Register table to expose the methods

Response: return Register


Prompt: --		print(animName .. " " .. idx .. " [" .. origRoll .. "]")

Response:
		local anim = animTable[animName][idx].anim

		-- load it to the humanoid; get AnimationTrack
		currentAnimTrack = humanoid:LoadAnimation(anim)

		-- play the animation
		currentAnimTrack:Play(transitionTime)
		currentAnim = animName

		-- set up keyframe name triggers
		if (currentAnimKeyframeHandler ~= nil) then
			currentAnimKeyframeHandler:disconnect()
		end
		currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
	end
end


Response:
mouse.KeyDown:connect(function (key)
    key = string.lower(key)
        if key == "a" then
            	a = true
        elseif key == "d" then
                d = true
        elseif key == "w" then
                w = true
                rwd.Throttle = 1
				rwd.Torque = tq
				lwd.Throttle = 1
				lwd.Torque = ftq
				rrwd.Throttle = 1
				rrwd.Torque = ftq
				rwd.MaxSpeed = 185
				lwd.MaxSpeed = 185
				rrwd.MaxSpeed = 185
                carSeat.Throttle = 1
                carSeat.Torque = 0
                elseif key == "s" then
                s = true
                carSeat.Throttle = 0
                carSeat.Torque = 0
				rwd.Throttle = -1
				rwd.Torque = brk
				lwd.Throttle = -1
				lwd.Torque = brk
				rrwd.Throttle = -1
				rrwd.Torque = brk
				rwd.MaxSpeed = 25
				lwd.MaxSpeed = 25
				rrwd.MaxSpeed = 25
                end
end)

mouse.KeyUp:connect(function (key)
    key = string.lower(key)
        if key == "a" then
                print("a up")
                if d == false then
                m.DesiredAngle = 0
                        n.DesiredAngle = m.DesiredAngle
                end
        elseif key == "d" then
                print("d up")
                if a == false then
                m.DesiredAngle = 0
                        n.DesiredAngle = m.DesiredAngle
end
        end
        a = false
        d = false
end)

mouse.KeyUp:connect(function (key)
    key = string.lower(key)
if key == "w" or key == "s" then
        rwd.Throttle = 0
        rwd.Torque = 0
	    lwd.Throttle = 0
		lwd.Torque = 0
		rrwd.Throttle = 0
		rrwd.Torque = 0

       carSeat.Throttle = 0
carSeat.Torque = cst
        end
end)

limitButton.MouseButton1Click:connect(function()


Prompt:
--You dont need to delete this text.
--PUT INSIDE a BUTTON in StarterGui
--Make sure to make a frame for the menu to pop up then go to properties > Visible [Off]

Response:
script.Parent.MouseButton1Click:Connect (function()
	script.Parent.Parent.Visible = false
end)


Prompt: --// Animations

Response:
	-- Idle Anim
	IdleAnim = function(char, speed, objs)
		TweenJoint(objs[2],  nil , CFrame.new(-0.902175903, 0.295501232, -1.07592201, 1, 0, 0, 0, 1.19248806e-08, 1, 0, -1, 1.19248806e-08), function(X) return math.sin(math.rad(X)) end, 0.25)
		TweenJoint(objs[3],  nil , CFrame.new(-0.0318467021, -0.0621779114, -1.67288721, 0.787567914, -0.220087856, 0.575584888, -0.615963876, -0.308488727, 0.724860668, 0.0180283934, -0.925416589, -0.378522098), function(X) return math.sin(math.rad(X)) end, 0.25)
		wait(0.18)
	end;

	-- FireMode Anim
	FireModeAnim = function(char, speed, objs)
		TweenJoint(objs[1],  nil , CFrame.new(0.340285569, 0, -0.0787199363, 0.962304771, 0.271973342, 0, -0.261981696, 0.926952124, -0.268561482, -0.0730415657, 0.258437991, 0.963262498), function(X) return math.sin(math.rad(X)) end, 0.25)
		wait(0.1)
		TweenJoint(objs[2],  nil , CFrame.new(0.67163527, -0.310947895, -1.34432662, 0.766044378, -2.80971371e-008, 0.642787576, -0.620885074, -0.258818865, 0.739942133, 0.166365519, -0.965925872, -0.198266774), function(X) return math.sin(math.rad(X)) end, 0.25)
		wait(0.17)
		objs[4]:WaitForChild("Click"):Play()
	end;

	-- Reload Anim
	ReloadAnim = function(char, speed, objs)
		TweenJoint(objs[2],  nil , CFrame.new(-0.902175903, 0.295501232, -1.07592201, 0.973990917, -0.226587087, 2.70202394e-09, -0.0646390691, -0.277852833, 0.958446443, -0.217171595, -0.933518112, -0.285272509), function(X) return math.sin(math.rad(X)) end, 0.5)
		TweenJoint(objs[3],  nil , CFrame.new(0.511569798, -0.0621779114, -1.63076854, 0.787567914, -0.220087856, 0.575584888, -0.615963876, -0.308488727, 0.724860668, 0.0180283934, -0.925416589, -0.378522098), function(X) return math.sin(math.rad(X)) end, 0.5)
		wait(0.5)

		local MagC = Tool:WaitForChild("Mag"):clone()
		MagC:FindFirstChild("Mag"):Destroy()
		MagC.Parent = Tool
		MagC.Name = "MagC"
		local MagCW = Instance.new("Motor6D")
		MagCW.Part0 = MagC
		MagCW.Part1 = workspace.CurrentCamera:WaitForChild("Arms"):WaitForChild("Left Arm")
		MagCW.Parent = MagC
		MagCW.C1 = MagC.CFrame:toObjectSpace(objs[4].CFrame)
		objs[4].Transparency = 1

		objs[6]:WaitForChild("MagOut"):Play()

		TweenJoint(objs[3],  nil , CFrame.new(0.511569798, -0.0621778965, -2.69811869, 0.787567914, -0.220087856, 0.575584888, -0.51537323, 0.276813388, 0.811026871, -0.337826759, -0.935379863, 0.104581922), function(X) return math.sin(math.rad(X)) end, 0.3)
		TweenJoint(objs[2],  nil , CFrame.new(-0.902175903, 0.295501232, -1.29060709, 0.973990917, -0.226587087, 2.70202394e-09, -0.0646390691, -0.277852833, 0.958446443, -0.217171595, -0.933518112, -0.285272509), function(X) return math.sin(math.rad(X)) end, 0.1)
		wait(0.1)
		TweenJoint(objs[2],  nil , CFrame.new(-0.902175903, 0.295501232, -1.07592201, 0.973990917, -0.226587087, 2.70202394e-09, -0.0646390691, -0.277852833, 0.958446443, -0.217171595, -0.933518112, -0.285272509), function(X) return math.sin(math.rad(X)) end, 0.3)
		wait(0.3)
		objs[6]:WaitForChild('MagIn'):Play()
		TweenJoint(objs[3],  nil , CFrame.new(0.511569798, -0.0621779114, -1.63076854, 0.787567914, -0.220087856, 0.575584888, -0.615963876, -0.308488727, 0.724860668, 0.0180283934, -0.925416589, -0.378522098), function(X) return math.sin(math.rad(X)) end, 0.3)
		wait(0.4)
		MagC:Destroy()
		objs[4].Transparency = 0
	end;

	-- Bolt Anim
		BoltBackAnim = function(char, speed, objs)
			TweenJoint(objs[3],  nil , CFrame.new(-0.603950977, 0.518400908, -1.07592201, 0.984651804, 0.174530268, -2.0812525e-09, 0.0221636202, -0.125041038, 0.991903961, 0.173117265, -0.97668004, -0.12699011), function(X) return math.sin(math.rad(X)) end, 0.25)
			wait(0.1)
			TweenJoint(objs[2],  nil , CFrame.new(-0.333807141, -0.492658436, -1.55705214, 0.140073985, -0.978677034, -0.150234282, -0.955578506, -0.173358306, 0.238361627, -0.259323537, 0.110172354, -0.959486008), function(X) return math.sin(math.rad(X)) end, 0.25)
			wait(0.4)
			objs[5]:WaitForChild("BoltBack"):Play()
			TweenJoint(objs[2],  nil , CFrame.new(-0.333807141, -0.609481037, -1.02827215, 0.140073985, -0.978677034, -0.150234282, -0.955578506, -0.173358306, 0.238361627, -0.259323537, 0.110172354, -0.959486008), function(X) return math.sin(math.rad(X)) end, 0.25)
			TweenJoint(objs[1],  nil , CFrame.new(0, 0, 0.230707675, 1, 0, 0, 0, 1, 0, 0, 0, 1), function(X) return math.sin(math.rad(X)) end, 0.25)
			TweenJoint(objs[3],  nil , CFrame.new(-0.603950977, 0.175939053, -1.07592201, 0.984651804, 0.174530268, -2.0812525e-09, 0.0221636202, -0.125041038, 0.991903961, 0.173117265, -0.97668004, -0.12699011), function(X) return math.sin(math.rad(X)) end, 0.25)
			wait(0.3)
		end;

		BoltForwardAnim = function(char, speed, objs)
			objs[5]:WaitForChild("BoltForward"):Play()
			TweenJoint(objs[1],  nil , CFrame.new(), function(X) return math.sin(math.rad(X)) end, 0.1)
			TweenJoint(objs[2],  nil , CFrame.new(-0.84623456, -0.900531948, -0.749261618, 0.140073985, -0.978677034, -0.150234282, -0.955578506, -0.173358306, 0.238361627, -0.259323537, 0.110172354, -0.959486008), function(X) return math.sin(math.rad(X)) end, 0.1)
			TweenJoint(objs[3],  nil , CFrame.new(-0.603950977, 0.617181182, -1.07592201, 0.984651804, 0.174530268, -2.0812525e-09, 0.0221636202, -0.125041038, 0.991903961, 0.173117265, -0.97668004, -0.12699011), function(X) return math.sin(math.rad(X)) end, 0.2)
			wait(0.2)
		end;

		-- Bolting Back
		BoltingBackAnim = function(char, speed, objs)
			TweenJoint(objs[1],  nil , CFrame.new(0, 0, 0.230707675, 1, 0, 0, 0, 1, 0, 0, 0, 1), function(X) return math.sin(math.rad(X)) end, 0.03)
		end;

		BoltingForwardAnim = function(char, speed, objs)
			TweenJoint(objs[1],  nil , CFrame.new(), function(X) return math.sin(math.rad(X)) end, 0.1)
		end;

		InspectAnim = function(char, speed, objs)
			ts:Create(objs[1],TweenInfo.new(1),{C1 = CFrame.new(0.805950999, 0.654529691, -1.92835355, 0.999723792, 0.0109803826, 0.0207702816, -0.0223077796, 0.721017241, 0.692557871, -0.00737112388, -0.692829967, 0.721063137)}):Play()
			ts:Create(objs[2],TweenInfo.new(1),{C1 = CFrame.new(-1.49363565, -0.699174881, -1.32277012, 0.66716975, -8.8829113e-09, -0.74490571, 0.651565909, -0.484672248, 0.5835706, -0.361035138, -0.874695837, -0.323358655)}):Play()
			wait(1)
			ts:Create(objs[2],TweenInfo.new(1),{C1 = CFrame.new(1.37424219, -0.699174881, -1.03685927, -0.204235911, 0.62879771, 0.750267386, 0.65156585, -0.484672219, 0.58357054, 0.730581641, 0.60803473, -0.310715646)}):Play()
			wait(1)
		end

	}

		nadeReload = function(char, speed, objs)
			ts:Create(objs[1], TweenInfo.new(0.6), {C1 = CFrame.new(-0.902175903, -1.15645337, -1.32277012, 0.984807789, -0.163175702, -0.0593911409, 0, -0.342020363, 0.939692557, -0.17364797, -0.925416529, -0.336824328)}):Play()
			ts:Create(objs[2], TweenInfo.new(0.6), {C1 = CFrame.new(0.805950999, 0.654529691, -1.92835355, 0.787567914, -0.220087856, 0.575584888, -0.323594928, 0.647189975, 0.690240026, -0.524426222, -0.72986728, 0.438486755)}):Play()
			wait(0.6)
			ts:Create(objs[2], TweenInfo.new(0.6), {C1 = CFrame.new(0.805950999, 0.559619546, -1.73060048, 0.802135408, -0.348581612, 0.484839559, -0.597102284, -0.477574915, 0.644508123, 0.00688350201, -0.806481719, -0.59121877)}):Play()
			wait(0.6)
		end;

		AttachAnim = function(char, speed, objs)
			TweenJoint(objs[1],  nil , CFrame.new(-2.05413628, -0.386312962, -0.955676377, 0.5, 0, -0.866025329, 0.852868497, -0.17364797, 0.492403895, -0.150383547, -0.984807789, -0.086823985), function(X) return math.sin(math.rad(X)) end, 0.25)
			TweenJoint(objs[2],  nil , CFrame.new(0.931334019, 1.66565645, -1.2231313, 0.787567914, -0.220087856, 0.575584888, -0.0180282295, 0.925416708, 0.378521889, -0.615963817, -0.308488399, 0.724860728), function(X) return math.sin(math.rad(X)) end, 0.25)
			wait(0.18)
		end;

		-- Patrol Anim
		PatrolAnim = function(char, speed, objs)
			TweenJoint(objs[1],  nil , sConfig.PatrolPosR, function(X) return math.sin(math.rad(X)) end, 0.25)
			TweenJoint(objs[2],  nil , sConfig.PatrolPosL, function(X) return math.sin(math.rad(X)) end, 0.25)
			wait(0.18)
		end;

return Settings


Prompt:
--------------------
--| Script Logic |--
--------------------

Response:
BaseShot = Instance.new('Part')
BaseShot.Name = 'Effect'
BaseShot.FormFactor = Enum.FormFactor.Custom
BaseShot.Size = Vector3.new(0.2, 0.2, 3)
BaseShot.CanCollide = false
BaseShot.BrickColor = BrickColor.new('Toothpaste')
SelectionBoxify(BaseShot)
Light(BaseShot)
HitFadeSound:Clone().Parent = BaseShot

Tool.Equipped:connect(OnEquipped)
Tool.Unequipped:connect(OnUnequipped)
Tool.Click.OnServerEvent:connect(function(client, hit)
	if client.Character == Tool.Parent then
		OnActivated(hit)
	end
end)


Prompt: --Code

Response:
if year == 2007 then
	script.Parent.ClickToChat.TextColor3 = Color3.new(0, 0, 0)
	script.Parent.ChatBar.BackgroundColor3 = Color3.new(255/255, 255/255, 255/255)
end

local Chat = {
	ChatColors = {
		BrickColor.new("Bright red"),
		BrickColor.new("Bright blue"),
		BrickColor.new("Earth green"),
		BrickColor.new("Bright violet"),
		BrickColor.new("Bright orange"),
		BrickColor.new("Bright yellow"),
		BrickColor.new("Light reddish violet"),
		BrickColor.new("Brick yellow"),
	};

	Gui = nil,
	Frame = nil,
	RenderFrame = nil,
	TapToChatLabel = nil,
	ClickToChatButton = nil,
	Templates = nil,
	EventListener = nil,
	MessageQueue = {},

	Configuration = {
		FontSize = Enum.FontSize.Size12,
		NumFontSize = 12,
		HistoryLength = 20,
		Size = UDim2.new(0.38, 0, 0.20, 0),
		MessageColor = Color3.new(1 , 1, 1),
		AdminMessageColor = Color3.new(1, 215/255, 0),
		XScale = 0.025,
		LifeTime = 45,
		Position = UDim2.new(0, 2, 0.05, 0),
		DefaultTweenSpeed = 0.15,
	};

	CachedSpaceStrings_List = {},
	Messages_List = {},
	MessageThread = nil,
	TempSpaceLabel = nil,
}

function GetNameValue(pName)
	local value = 0
	for index = 1, #pName do
		local cValue = string.byte(string.sub(pName, index, index))
		local reverseIndex = #pName - index + 1
		if #pName%2 == 1 then
			reverseIndex = reverseIndex - 1
		end
		if reverseIndex%4 >= 2 then
			cValue = -cValue
		end
		value = value + cValue
	end
	return value%8
end

function Chat:ComputeChatColor(pName)
	return self.ChatColors[GetNameValue(pName) + 1].Color
end

function Chat:UpdateQueue(field, diff)
	for i = #self.MessageQueue, 1, -1 do
		if self.MessageQueue[i] then
			for _, label in pairs(self.MessageQueue[i]) do
				if label and type(label) ~= "table" and type(label) ~= "number" then
					if label:IsA("TextLabel") or label:IsA("TextButton") then
						if diff then
							label.Position = label.Position - UDim2.new(0, 0, diff, 0)
						else
							if field == self.MessageQueue[i] then
								label.Position = UDim2.new(self.Configuration.XScale, 0, label.Position.Y.Scale - field["Message"].Size.Y.Scale , 0)
							else
								label.Position = UDim2.new(self.Configuration.XScale, 0, label.Position.Y.Scale - field["Message"].Size.Y.Scale, 0)
							end
							if label.Position.Y.Scale < -0.01 then
								label.Visible = false
								label:Destroy()
							end
						end
					end
				end
			end
		end
	end
end

function Chat:ComputeSpaceString(pLabel)
	local nString = " "
	if not self.TempSpaceLabel then
		self.TempSpaceLabel = self.Templates.SpaceButton
		self.TempSpaceLabel.Size = UDim2.new(0, pLabel.AbsoluteSize.X, 0, pLabel.AbsoluteSize.Y);
	end
	self.TempSpaceLabel.Text = nString
	while self.TempSpaceLabel.TextBounds.X < pLabel.TextBounds.X do
		nString = nString .. " "
		self.TempSpaceLabel.Text = nString
	end
	nString = nString .. " "
	self.CachedSpaceStrings_List[pLabel.Text] = nString
	self.TempSpaceLabel.Text = ""
	return nString
end

function Chat:UpdateChat(cPlayer, message)
	local messageField = {["Player"] = cPlayer,["Message"] = message}
	if coroutine.status(Chat.MessageThread) == "dead" then
		table.insert(Chat.Messages_List, messageField)
		Chat.MessageThread = coroutine.create(function ()
			for i = 1, #Chat.Messages_List do
				local field = Chat.Messages_List[i]
				Chat:CreateMessage(field["Player"], field["Message"])
			end
			Chat.Messages_List = {}
		end)
		coroutine.resume(Chat.MessageThread)
	else
		table.insert(Chat.Messages_List, messageField)
	end
end

function Chat:CreateMessage(cPlayer, message)
	local pName = cPlayer ~= nil and cPlayer.Name or "GAME"
	message = message:gsub("^%s*(.-)%s*$", "%1")
	self.MessageQueue[#self.MessageQueue] = (#self.MessageQueue > self.Configuration.HistoryLength) and nil or self.MessageQueue[#self.MessageQueue]
	local pLabel = self.Templates.pLabel:clone()
	pLabel.Name = pName;
	pLabel.Text = pName .. ";";
	pLabel.Parent = self.RenderFrame;
	pLabel.TextColor3 = (cPlayer.Neutral) and Chat:ComputeChatColor(pName) or cPlayer.TeamColor.Color
	local nString = self.CachedSpaceStrings_List[pName] or Chat:ComputeSpaceString(pLabel)
	local mLabel = self.Templates.mLabel:clone()
	mLabel.Name = pName .. " - message";
	mLabel.TextColor3 = Chat.Configuration.MessageColor;
	mLabel.Text = nString .. message;
	mLabel.Parent = self.RenderFrame;
	local heightField = mLabel.TextBounds.Y
	mLabel.Size = UDim2.new(1, 0, heightField/self.RenderFrame.AbsoluteSize.Y, 0)
	pLabel.Size = mLabel.Size
	local yPixels = self.RenderFrame.AbsoluteSize.Y
	local yFieldSize = mLabel.TextBounds.Y
	local queueField = {}
	queueField["Player"] = pLabel
	queueField["Message"] = mLabel
	queueField["SpawnTime"] = tick()
	table.insert(self.MessageQueue, 1, queueField)
	Chat:UpdateQueue(queueField)
end

function Chat:CreateChatBar()
	self.ClickToChatButton = self.Gui:WaitForChild("ClickToChat")
	self.ChatBar = self.Gui:WaitForChild("ChatBar")
	local mouse = game.Players.LocalPlayer:GetMouse()
	mouse.KeyDown:connect(function (key)
		if key:byte() == 47 or key == "/" then
			wait(0.00000001)
			self.ClickToChatButton.Visible = false
			if year > 2007 then
				self.ChatBar.BackgroundColor3 = Color3.new(0/255, 0/255, 0/255)
			end
			self.ChatBar:CaptureFocus()
		end
	end)
	self.ClickToChatButton.MouseButton1Click:connect(function ()
		self.ClickToChatButton.Visible = false
		if year > 2007 then
			self.ChatBar.BackgroundColor3 = Color3.new(0/255, 0/255, 0/255)
		end
		self.ChatBar:CaptureFocus()
	end)
end

function Chat:PlayerChat(message)
	local m = Instance.new("StringValue")
	m.Name = "NewMessage"
	m.Value = message
	m.Parent = game.Players.LocalPlayer
	game:GetService("Debris"):AddItem(m, 2)
end

function Chat:CreateGui()
	self.Gui = script.Parent
	self.Frame = self.Gui:WaitForChild("ChatFrame")
	self.RenderFrame = self.Frame:WaitForChild("ChatRenderFrame")
	self.Templates = self.Gui:WaitForChild("Templates")
	Chat:CreateChatBar()
	self.ChatBar.FocusLost:connect(function(enterPressed)
		if year > 2007 then
			self.ChatBar.BackgroundColor3 = Color3.new(0/255, 0/255, 0/255)
		end
		if enterPressed and self.ChatBar.Text ~= "" then
			local cText = self.ChatBar.Text
			if string.sub(self.ChatBar.Text, 1, 1)  == "%" then
				cText = "(TEAM) " .. string.sub(cText, 2, #cText)
			end
			Chat:PlayerChat(cText)
			if self.ClickToChatButton then
				self.ClickToChatButton.Visible = true
			end
			self.ChatBar.Text = ""
			self.ClickToChatButton.Visible = true
		end
	end)
end

function Chat:TrackPlayerChats()
	local function chatRegister(p)
		p.ChildAdded:connect(function (obj)
			if obj:IsA("StringValue") and obj.Name == "NewMessage" then
				if game.Players.LocalPlayer.Neutral or p.TeamColor == game.Players.LocalPlayer.TeamColor then
					Chat:UpdateChat(p, obj.Value)
				end
			end
		end)
	end
	for _,v in pairs(game.Players:GetPlayers()) do
		chatRegister(v)
	end
	game.Players.PlayerAdded:connect(chatRegister)
end

function Chat:CullThread()
	Spawn(function ()
		while true do
			if #self.MessageQueue > 0 then
				for _, field in pairs(self.MessageQueue) do
					if field["SpawnTime"] and field["Player"] and field["Message"] and tick() - field["SpawnTime"] > self.Configuration.LifeTime then
						field["Player"].Visible = false
						field["Message"].Visible = false
					end
				end
			end
			wait(5)
		end
	end)
end

function Chat:Initialize()
	Chat:CreateGui()
	Chat:TrackPlayerChats()
	self.MessageThread = coroutine.create(function () end)
						 coroutine.resume(self.MessageThread)
	Chat:CullThread()
end

Chat:Initialize()


Prompt: -- Folder that contains the RemoteEvents

Response: local RemoteFolder = Home:WaitForChild("RemoteEvents")


Prompt: --Rescripted by Luckymaxer

Response:
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")

Players = game:GetService("Players")

Animations = {}

ServerControl = Tool:WaitForChild("ServerControl")
ClientControl = Tool:WaitForChild("ClientControl")

Rate = (1 / 60)

ToolEquipped = false

function CheckIfAlive()
	return (((Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Player and Player.Parent) and true) or false)
end

function Equipped(Mouse)
	Character = Tool.Parent
	Player = Players:GetPlayerFromCharacter(Character)
	Humanoid = Character:FindFirstChild("Humanoid")
	ToolEquipped = true
	if not CheckIfAlive() then
		return
	end
	Spawn(function()
		PlayerMouse = Mouse
		Mouse.Button1Down:connect(function()
			InvokeServer("Button1Click", {Down = true})
		end)
		Mouse.Button1Up:connect(function()
			InvokeServer("Button1Click", {Down = false})
		end)
	end)
end

function Unequipped()
	for i, v in pairs(Animations) do
		if v and v.AnimationTrack then
			v.AnimationTrack:Stop()
		end
	end
	Animations = {}
	ToolEquipped = false
end

function InvokeServer(mode, value)
	local ServerReturn = nil
	pcall(function()
		ServerReturn = ServerControl:InvokeServer(mode, value)
	end)
	return ServerReturn
end

function OnClientInvoke(mode, value)
	if mode == "PlaySound" and value then
		value:Play()
	elseif mode == "StopSound" and value then
		value:Stop()
	elseif mode == "MousePosition" then
		return ((PlayerMouse and {Position = PlayerMouse.Hit.p, Target = PlayerMouse.Target}) or nil)
	end
end

ClientControl.OnClientInvoke = OnClientInvoke

Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)


Prompt: --DO NOT CHANGE ANYTHING INSIDE OF THIS SCRIPT BESIDES WHAT YOU ARE TOLD TO UNLESS YOU KNOW WHAT YOU'RE DOING OR THE SCRIPT WILL NOT WORK!!

Response:
local hitPart = script.Parent
local debounce = true
local tool = game.ServerStorage.DeliciousCake -- Change "Sword" to the name of your tool, make sure your tool is in ServerStorage

hitPart.Touched:Connect(function(hit)
	if debounce == true then
		if hit.Parent:FindFirstChild("Humanoid") then
			local plr = game.Players:FindFirstChild(hit.Parent.Name)
			if plr then
				debounce = false
				hitPart.BrickColor = BrickColor.new("Bright red")
				tool:Clone().Parent = plr.Backpack
				wait(3) -- Change "3" to however long you want the player to have to wait before they can get the tool again
				debounce = true
				hitPart.BrickColor = BrickColor.new("Bright green")
			end
		end
	end
end)


Prompt:
--[[

A function which gets the character given one part in that character.

--]]

Response:
return function(p)
	while p and not p:FindFirstChild("Humanoid") do
		p = p.Parent;
	end
	return p;
end


Prompt: --[[Engine]]

Response:
	--Torque Curve
	Tune.Horsepower		= 479		--	[TORQUE CURVE VISUAL]
	Tune.IdleRPM		= 700		--		https://www.desmos.com/calculator/2uo3hqwdhf
	Tune.PeakRPM		= 6000		--		Use sliders to manipulate values
	Tune.Redline		= 6700		--		Copy and paste slider values into the respective tune values
	Tune.EqPoint		= 5500
	Tune.PeakSharpness	= 7.5
	Tune.CurveMult		= 0.16

	--Incline Compensation
	Tune.InclineComp	= 4.7			-- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)

	--Misc
	Tune.RevAccel		= 150		-- RPM acceleration when clutch is off
	Tune.RevDecay		= 75		-- RPM decay when clutch is off
	Tune.RevBounce		= 500		-- RPM kickback from redline
	Tune.IdleThrottle	= 3			-- Percent throttle at idle
	Tune.ClutchTol		= 500		-- Clutch engagement threshold (higher = faster response)


Prompt: --Thermostat.Parent.IsHeatMode.Changed:connect(Active)


Prompt: -- Placeholder texture can be any roblox asset link

Response:
local initialTexture = ""

local RowCount = 3 -- rows in one sprite
local ColCount = 4 -- columns in one sprite
local perImageSpriteCount = RowCount * ColCount
local width = 229 -- image rect size
local height = 341

local framesInTotal = 12
assert(numImages * RowCount * ColCount >= framesInTotal)

local animPeriod = 1 -- period for the whole animation, in seconds
assert(animPeriod > 0)

local curImageIdx = 0
local curSpriteIdx = 0

local fps = framesInTotal / animPeriod
local accumulatedTime = 0

local function AnimateImageSpriteSheet(dt)
	accumulatedTime = math.fmod(accumulatedTime + dt, animPeriod)
	curSpriteIdx = math.floor(accumulatedTime * fps)

	local prevImageIndex = curImageIdx
	curImageIdx = math.floor(curSpriteIdx / perImageSpriteCount)
	if prevImageIndex ~= curImageIdx then
		imageInstance.Image = imageAssetIDs[curImageIdx + 1]
	end

	local localSpriteIndex = curSpriteIdx - curImageIdx * perImageSpriteCount
	local row = math.floor(localSpriteIndex / ColCount)
	local col = localSpriteIndex - row * ColCount
	imageInstance.ImageRectOffset = Vector2.new(col * width, row * height)
end

Animator.Connection = nil

Animator.Init = function()
	Animator.Connection = game:GetService("RunService").RenderStepped:Connect(AnimateImageSpriteSheet)
end

Animator.Stop = function()
	if Animator.Connection then
		imageInstance.Image = initialTexture
		Animator.Connection:Disconnect()
	end
end

return Animator


Prompt:
-- Given a label, return a function which given a string,
-- right-aligns it preceding the colon in the label.

Response:
function getRightAlignedPrinter(label: string): PrintLabel
	-- Assume that the label contains a colon.
	local index = label:find(":")
	local suffix = label:sub(index)

	return function(string_: string, isExpectedCall: boolean)
		local retval
		if isExpectedCall then
			retval = "->" .. string.rep(" ", math.max(0, index - 3 - #string_))
		else
			retval = string.rep(" ", math.max(0, index - 1 - #string_))
		end

		return retval .. string_ .. suffix
	end
end


Prompt: --[[Drivetrain]]

Response:
	Tune.Config			= "RWD"		--"FWD" , "RWD" , "AWD"

	--Differential Settings
	Tune.FDiffSlipThres	= 50		-- 1 - 100%				(Max threshold of applying full lock determined by deviation from avg speed)
	Tune.FDiffLockThres	= 50		-- 0 - 100%				(0 - Bias toward slower wheel, 100 - Bias toward faster wheel)
	Tune.RDiffSlipThres	= 15		-- 1 - 100%
	Tune.RDiffLockThres	= 50		-- 0 - 100%
	Tune.CDiffSlipThres	= 50		-- 1 - 100%				[AWD Only]
	Tune.CDiffLockThres	= 50		-- 0 - 100%				[AWD Only]

	--Traction Control Settings
	Tune.TCSEnabled		= true		-- Implements TCS
	Tune.TCSThreshold	= 20		-- Slip speed allowed before TCS starts working (in SPS)
	Tune.TCSGradient	= 20		-- Slip speed gradient between 0 to max reduction (in SPS)
	Tune.TCSLimit		= 10		-- Minimum amount of torque at max reduction (in percent)


Prompt: --                                                     in the mainUI

Response:
infoButton.MouseButton1Down:Connect(function()
	topbar_infoButton_p:Play()
	darkenScreen()
	showAboutWindow()
	aboutWindow.Visible = true
end)

infoButton.MouseButton1Up:Connect(function()
	topbar_infoButton_f:Cancel()
	topbar_infobutton_r:Play()
	topbar_infobutton_r.Completed:Wait()
	topbar_infoButton_nf:Play()
end)

local aboutCloseButton = aboutWindow.Close


Prompt:
------------------------------------------------------------------------
-- parse a function name specification
-- * used in funcstat()
------------------------------------------------------------------------

Response:
function luaY:funcname(ls, v)
  -- funcname -> NAME {field} [':' NAME]
  local needself = false
  self:singlevar(ls, v)
  while ls.t.token == "." do
    self:field(ls, v)
  end
  if ls.t.token == ":" then
    needself = true
    self:field(ls, v)
  end
  return needself
end


Prompt:
--Connect Mouse1Down/Up events to the button to register touch input
--Use MouseButton1Down instead of input start to ensure it only registers touches that originate on the button

Response:
EnterImageButton.MouseButton1Down:Connect(function()
	if UserInputService:GetLastInputType() == Enum.UserInputType.Touch then
		--Only register it when in touch mode so that PC users dont click on it by accident
		EnterImageButton.ImageTransparency = 1
		EnterImageButton.Pressed.ImageTransparency = 0

		EnterKeyDown = true
		enterStart()
	end
end)

EnterImageButton.MouseButton1Up:Connect(function()
	if UserInputService:GetLastInputType() == Enum.UserInputType.Touch then
		EnterKeyDown = false
		--Return button image to unpressed
		EnterImageButton.ImageTransparency = 0
		EnterImageButton.Pressed.ImageTransparency = 1
	end
end)

EnterImageButton.InputEnded:Connect(function(Input)
	--Use a third connection to prevent the button getting stuck in pressed mode
	if Input.UserInputType == Enum.UserInputType.Touch then
		--Return button image to unpressed, user has stopped touching the button
		EnterImageButton.ImageTransparency = 0
		EnterImageButton.Pressed.ImageTransparency = 1
	end
end)

FlipImageButton.MouseButton1Down:Connect(function()
	if UserInputService:GetLastInputType() == Enum.UserInputType.Touch then
		FlipImageButton.ImageTransparency = 1
		FlipImageButton.Pressed.ImageTransparency = 0
	end
end)

FlipImageButton.MouseButton1Up:Connect(function()
	if UserInputService:GetLastInputType() == Enum.UserInputType.Touch then
		FlipImageButton.ImageTransparency = 0
		FlipImageButton.Pressed.ImageTransparency = 1
		if AdornedSeat then
			if isFlipped(AdornedSeat) then
				flipSeat()
			end
		end
	end
end)

EnterImageButton.InputEnded:Connect(function(Input)
	if Input.UserInputType == Enum.UserInputType.Touch then
		FlipImageButton.ImageTransparency = 0
		FlipImageButton.Pressed.ImageTransparency = 1
	end
end)


Prompt: ----[INITIALIZE VARIABLES]----

Response:
function Initialize()
	for i = 1, #ColorPickers do
		table.insert(PreviewColor, ColorPickers[i].PreviewColor)
		table.insert(RGBHolders, ColorPickers[i].RGBValues)
		table.insert(Errors, ColorPickers[i].Parent.Parent.Error)
		local Inputs = {
			RGBHolders[i].Red.Value,
			RGBHolders[i].Green.Value,
			RGBHolders[i].Blue.Value
		}
	 	local Hitboxes = {
			RGBHolders[i].Red.Slider.Hitbox,
			RGBHolders[i].Green.Slider.Hitbox,
			RGBHolders[i].Blue.Slider.Hitbox
		}
		local Sliders = {
			RGBHolders[i].Red.Slider.Hitbox.Slider,
			RGBHolders[i].Green.Slider.Hitbox.Slider,
			RGBHolders[i].Blue.Slider.Hitbox.Slider
		}
		table.insert(RGBInputs, Inputs)
		table.insert(RGBSliderHitboxes, Hitboxes)
		table.insert(RGBSliders, Sliders)
		UpdatePreviewColor(i)
		UpdateRGBSliders(i)
	end
end
Initialize()


Prompt:
------------------------------------------------------------------------
-- stuff

Response:
do
	script.Parent.Equipped:Connect(function()
		if player == nil then
			player = game:GetService("Players"):GetPlayerFromCharacter(script.Parent.Parent)
		end
		if character == nil or character.Parent == nil then
			character = script.Parent.Parent
			humanoid = character.Humanoid
				isR15 = humanoid.RigType == Enum.HumanoidRigType.R15
			rightHand = isR15 and character:WaitForChild("RightHand") or character:WaitForChild("Right Arm")
		end
		local getWeld = rightHand:WaitForChild("RightGrip")
		motor = Instance.new("Motor6D")
		motor.Name = motorName
		motor.Part0 = getWeld.Part0
		motor.Part1 = getWeld.Part1
		--motor.C0 = getWeld.C0
		--motor.C1 = getWeld.C1

		getWeld:Destroy()
		motor.Parent = rightHand
	end)
	script.Parent.Unequipped:Connect(function()
		motor:Destroy()
	end)
end


Prompt: -- Teleport failure handling

Response:
function Queue._onTeleportFailure(player, status, message)
	Log.Error.Queue("Teleport Failed: %s (%s)", player.Name, message)

	-- Add this player to the latest queue given that they failed out of the previous one
	Queue._addToQueue(player)
end

function Queue._sendStatus(forcePlayer)
	local waitTime = tick() - _lastTeleport
	local playerCount = Queue._currentQueueCount()

	local status = {
		enabled = Queue._timeoutEnabled,
		waiting_for = Conf.min_queue_players - playerCount,
		max_players = Conf.max_queue_players,
		current_players = playerCount,
		time_remaining = math.max(0, Conf.queue_time_limit - (tick() - _lastTeleport)),
	}

	if forcePlayer then
		Broadcast.fireRemoteClient(forcePlayer, "QUEUE_STATUS", status)
	else
		for player, time in pairs(_currentQueue) do
			Broadcast.fireRemoteClient(player, "QUEUE_STATUS", status)
		end
	end
end

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

	for _, weaponInstance in pairs(WeaponsFolder:GetChildren()) do
		weaponInstance:Clone().Parent = StarterPack
	end

	return self
end

function Queue:playerAdded(player)
	Log.Debug.Queue("Added player %s", player.Name)
	Queue._addToQueue(player)

	----
	-- find the humanoid, and detect when it dies
	player.CharacterAdded:Connect(function(character)
		local humanoid = character:FindFirstChild("Humanoid")

		if humanoid then
			local loading = nil

			humanoid.Died:Connect(function()
				if not loading then
					loading = true
					wait(3)
					Util.loadCharacter(player)
				end
			end)
		end
	end)

	--
	Util.loadCharacter(player)
end

function Queue:playerRemoving(player)
	Log.Debug.Queue("Removed player %s", player.Name)
	Queue._removeFromQueue(player)
end

function Queue:initialize()
	Log.Warn.Queue("STARTING")

	self.requestConn = Broadcast.registerHandler("QUEUE_STATUS_REQUEST", function(player)
		Queue._sendStatus(player)
	end)

	if not WeaponsSystem.doingSetup and not WeaponsSystem.didSetup then
		WeaponsSystem.setup()
	end

	DamageHandler.setup()

	for _, player in ipairs(Players:GetPlayers()) do
		self:playerAdded(player)
	end

	TeleportService.TeleportInitFailed:Connect(Queue._onTeleportFailure)

	if not Conf.disable_queue then
		spawn(function()
			while true do
				local waitTime = tick() - _lastTeleport
				local currentCount = Queue._currentQueueCount()

				if not Queue._timeoutEnabled or waitTime < Conf.queue_time_limit or currentCount < Conf.min_queue_players then
					wait(1)

				else
					Log.Debug.Queue("Queue is progressing.  Buckle up for fun.  *MAXIMUM* fun...")

					Queue._teleportQueue()
				end
			end
		end)
	end

	Log.Warn.Queue("STARTED")
end

function Queue:destroy()
	Broadcast.unregisterHandler(self.requestConn)
end


Prompt: -- Services

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


Prompt:
--[[**
	Gets a dictionary of the given group's information.
	@param [Integer] GroupID The group you are checking.
	@returns [Dictionary] The group's information.
**--]]

Response:
function GroupService:GetGroupInfoAsync(GroupID)
	local Success, GroupInfo = pcall(RbxGroupService.GetGroupInfoAsync, RbxGroupService, GroupID)
	return Success and GroupInfo or {}
end

return GroupService


Prompt:
--[=[
	Utility methods for promise
	@class PromiseUtils
]=]

Response:
local require = require(script.Parent.loader).load(script)

local Promise = require("Promise")

local PromiseUtils = {}


Prompt:
-- Factor of torque applied to change the wheel direction
-- Larger number generally means faster braking

Response: local BRAKING_TORQUE = 1000


Prompt:
-- NEW v12.0.0: Casters now use a data packet which can be made like what follows.
-- Check the API for more information: https://etithespirit.github.io/FastCastAPIDocs/fastcast-objects/fcbehavior

Response:
local CastBehavior = FastCast.newBehavior()
CastBehavior.RaycastParams = CastParams
CastBehavior.MaxDistance = BULLET_MAXDIST
CastBehavior.HighFidelityBehavior = FastCast.HighFidelityBehavior.Default


Prompt: -- use a remote function for setup to avoid async

Response:
remotes.setup.OnServerEvent:Connect(function(player, isR15, weapon)
	local weapon = weapon:Clone();

	local character = player.Character;
	local humanoid = character:WaitForChild("Humanoid");

	local joint = Instance.new("Motor6D");
	joint.Part0 = character:WaitForChild(isR15 and "RightHand" or "Right Arm");
	joint.Part1 = weapon:WaitForChild("Handle");
	joint.Parent = weapon.Handle;

	weapon.Parent = character;
	weapons[player] = require(weapon:WaitForChild("settings"))(isR15);

	local tilt = spring.new(0, 0, 0, 10, 1);
	local recoil = spring.new(Vector2.new(), Vector2.new(), Vector2.new(), 20, 1);

	springs[player] = {};
	springs[player].tilt = tilt;
	springs[player].recoil = recoil;

	-- update the character according to their rig type
	local tiltFunc, recoilFunc;
	if (isR15) then
		local neck = character:WaitForChild("Head"):WaitForChild("Neck");
		local waist = character:WaitForChild("UpperTorso"):WaitForChild("Waist");
		local rShoulder = character:WaitForChild("RightUpperArm"):WaitForChild("RightShoulder");
		local lShoulder = character:WaitForChild("LeftUpperArm"):WaitForChild("LeftShoulder");

		local neckC0 = neck.C0;
		local waistC0 = waist.C0;
		local rShoulderC0 = rShoulder.C0;
		local lShoulderC0 = lShoulder.C0;

		function tiltFunc(theta)
			neck.C0 = neckC0 * CFrame.fromEulerAnglesYXZ(theta, 0, 0);
			waist.C0 = waistC0 * CFrame.fromEulerAnglesYXZ(theta, 0, 0);
			rShoulder.C0 = rShoulderC0 * CFrame.fromEulerAnglesYXZ(theta, 0, 0);
			lShoulder.C0 = lShoulderC0 * CFrame.fromEulerAnglesYXZ(theta, 0, 0);
		end

		function recoilFunc(x, y)
			rShoulder.C0 = rShoulder.C0 * CFrame.new(0, 0, x);
			lShoulder.C0 = lShoulder.C0 * CFrame.new(0, 0, y);
		end
	else
		local torso = character:WaitForChild("Torso");
		local hrp = character:WaitForChild("HumanoidRootPart");

		local neck = torso:WaitForChild("Neck");
		local root = hrp:WaitForChild("RootJoint");
		local rShoulder = torso:WaitForChild("Right Shoulder");
		local lShoulder = torso:WaitForChild("Left Shoulder");
		local rHip = torso:WaitForChild("Right Hip");
		local lHip = torso:WaitForChild("Left Hip");

		local neckC0 = neck.C0;
		local rootC0 = root.C0;
		local rShoulderC0 = rShoulder.C0;
		local lShoulderC0 = lShoulder.C0;
		local rHipC0 = rHip.C0;
		local lHipC0 = lHip.C0;

		-- rotating the R6 joints is so arbitrary
		function tiltFunc(theta)
			neck.C0 = neckC0 * CFrame.fromEulerAnglesYXZ(-theta, 0, 0);
			root.C0 = rootC0 * CFrame.new(0, 0, -1) * CFrame.fromEulerAnglesYXZ(-theta, 0, 0) * CFrame.new(0, 0, 1);
			rShoulder.C0 = rShoulderC0 * CFrame.fromEulerAnglesYXZ(0, 0, theta);
			lShoulder.C0 = lShoulderC0 * CFrame.fromEulerAnglesYXZ(0, 0, -theta);
			rHip.C0 = rHipC0 * CFrame.fromEulerAnglesYXZ(0, 0, -theta);
			lHip.C0 = lHipC0 * CFrame.fromEulerAnglesYXZ(0, 0, theta);
		end

		function recoilFunc(x, y)
			rShoulder.C0 = rShoulder.C0 * CFrame.new(-x, 0, 0);
			lShoulder.C0 = lShoulder.C0 * CFrame.new(y, 0, 0);
		end
	end

	local heartBeat = runService.Heartbeat:Connect(function(dt)
		tilt:update(dt);
		recoil:update(dt);

		tiltFunc(states[humanoid:GetState()] and 0 or tilt.p / 2);
		recoilFunc(recoil.p.x, recoil.p.y);
	end)

	-- disconnect on death
	local died; died = player.Character.Humanoid.Died:Connect(function()
		heartBeat:Disconnect();
		died:Disconnect();
	end)

	-- store this for later
	cleanup[player] = {
		tiltFunc;
		heartBeat;
		died;
		weapon;
		joint;
		recoilFunc;
	}
end)

remotes.cleanup.OnServerEvent:Connect(function(player)
	local clean = cleanup[player];
	if (clean) then
		clean[2]:Disconnect();
		clean[1](0);
		clean[3]:Disconnect();
		clean[4]:Destroy();
		clean[5]:Destroy();
		clean[6](0, 0);
	end
end)


Prompt: -- A state object whose value is derived from other objects using a callback.

Response:
export type ComputedPairs<K, VI, VO> = PubTypes.ComputedPairs<K, VO> & {
	_oldDependencySet: Set<PubTypes.Dependency>,
	_processor: (K, VI) -> VO,
	_destructor: (VO) -> (),
	_inputIsState: boolean,
	_inputTable: PubTypes.CanBeState<{[K]: VI}>,
	_oldInputTable: {[K]: VI},
	_outputTable: {[K]: VO},
	_oldOutputTable: {[K]: VO},
	_keyData: {[K]: {
		dependencySet: Set<PubTypes.Dependency>,
		oldDependencySet: Set<PubTypes.Dependency>,
		dependencyValues: {[PubTypes.Dependency]: any}
	}}
}


Prompt: --// Animations

Response:
local L_140_

function IdleAnim(L_282_arg1)
	L_23_.IdleAnim(L_3_, L_140_, {
		L_30_,
		L_31_,
		L_32_
	});
end;

function EquipAnim(L_283_arg1)
	L_23_.EquipAnim(L_3_, L_140_, {
		L_30_
	});
end;

function UnequipAnim(L_284_arg1)
	L_23_.UnequipAnim(L_3_, L_140_, {
		L_30_
	});
end;

function FireModeAnim(L_285_arg1)
	L_23_.FireModeAnim(L_3_, L_140_, {
		L_30_,
		L_32_,
		L_31_,
		L_40_
	});
end

function ReloadAnim(L_286_arg1)
	L_23_.ReloadAnim(L_3_, L_140_, {
		L_30_,
		L_31_,
		L_32_,
		L_43_,
		L_3_:WaitForChild('Left Arm'),
		L_40_,
		L_34_,
		L_3_:WaitForChild('Right Arm'),
		L_28_
	});
end;

function BoltingBackAnim(L_287_arg1)
	L_23_.BoltingBackAnim(L_3_, L_140_, {
		L_34_
	});
end

function BoltingForwardAnim(L_288_arg1)
	L_23_.BoltingForwardAnim(L_3_, L_140_, {
		L_34_
	});
end

function BoltingForwardAnim(L_289_arg1)
	L_23_.BoltingForwardAnim(L_3_, L_140_, {
		L_34_
	});
end

function BoltBackAnim(L_290_arg1)
	L_23_.BoltBackAnim(L_3_, L_140_, {
		L_34_,
		L_32_,
		L_31_,
		L_30_,
		L_44_
	});
end

function BoltForwardAnim(L_291_arg1)
	L_23_.BoltForwardAnim(L_3_, L_140_, {
		L_34_,
		L_32_,
		L_31_,
		L_30_,
		L_44_
	});
end

function InspectAnim(L_292_arg1)
	L_23_.InspectAnim(L_3_, L_140_, {
		L_32_,
		L_31_
	});
end

function nadeReload(L_293_arg1)
	L_23_.nadeReload(L_3_, L_140_, {
		L_31_,
		L_32_
	});
end


Prompt:
--[[
	Creates a function that invokes a callback with correct error handling and
	resolution mechanisms.
]]

Response:
local function createAdvancer(callback, resolve, reject)
	return function(...)
		local resultLength, result = wpcallPacked(callback, ...)
		local ok = result[1]

		if ok then
			resolve(unpack(result, 2, resultLength))
		else
			reject(unpack(result, 2, resultLength))
		end
	end
end

local function isEmpty(t)
	return next(t) == nil
end

local function createSymbol(name)
	assert(type(name) == "string", "createSymbol requires `name` to be a string.")

	local symbol = newproxy(true)

	getmetatable(symbol).__tostring = function()
		return ("Symbol(%s)"):format(name)
	end

	return symbol
end

local PromiseMarker = createSymbol("PromiseMarker")

local Promise = {}
Promise.prototype = {}
Promise.__index = Promise.prototype

Promise.Status = {
	Started = createSymbol("Started"),
	Resolved = createSymbol("Resolved"),
	Rejected = createSymbol("Rejected"),
	Cancelled = createSymbol("Cancelled"),
}


Prompt: ---This function sets the position of the Plot

Response:
function module.SetCharVisibility(Char,Amount,Car)
	---Getting the player meshparts and decals
	for _,v in pairs(Char:GetDescendants()) do

		if v:IsA("MeshPart") or v:IsA("Part") or v:IsA("BasePart") then
			if Amount > 0 then
				v.CollisionGroupId = 3
			else
				v.CollisionGroupId = 0
			end
		end
		---Checking what the model is
		if v:IsA("MeshPart") or v:IsA("Decal") or v:IsA("Part") and v.Name ~= "HumanoidRootPart" then
			v.Transparency = Amount
		end

		---Modifying name tag
	--	local Nametag = Char.HumanoidRootPart.NameTag
		local ExtendSize = nil

		if Car ~= nil then
			if Car:IsA("Model") then
				ExtendSize = Car:GetExtentsSize()
			elseif Car.Parent:IsA("Model") then
				ExtendSize = Car.Parent:GetExtentsSize()
			end
		end

		--if ExtendSize ~= nil then
		--	if ExtendSize.Y > 8 then
		--		Nametag.ExtentsOffsetWorldSpace = Vector3.new(0,4 + ExtendSize.Y - 8, 0)
		--		Nametag.MaxDistance = 40
		--	else
		--		Nametag.ExtentsOffsetWorldSpace = Vector3.new(0,4,0)
		--		Nametag.MaxDistance = 40
		--	end
		--else
		--	Nametag.ExtentsOffsetWorldSpace = Vector3.new(0,4,0)
		--	Nametag.MaxDistance = 85
		--end

		---Modifying camera zoom
		if Amount > 0 then
			game.Players:GetPlayerFromCharacter(Char).CameraMinZoomDistance = 10
		else
			game.Players:GetPlayerFromCharacter(Char).CameraMinZoomDistance = 0.5
		end
	end

end

return module


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.Money.Gold.Value > 8 then
		return true
	end
	return false
end


Prompt: --// Handling Settings

Response:
	Firerate = 60 / 450; -- 60 = 1 Minute, 450 = Rounds per that 60 seconds. DO NOT TOUCH THE 60!

	FireMode = 1; -- 1 = Semi, 2 = Auto, 3 = Burst, 4 = Bolt Action, 5 = Shot, 6 = Explosive


Prompt: --- Color ---

Response:
button.MouseEnter:Connect(function()
	local Color = Color3.fromRGB(60, 60, 60)
	TweenService:Create(button, Info, {BackgroundColor3 = Color}):Play()
end)

button.MouseLeave:Connect(function()
	local ColorColor = Color3.fromRGB(43, 43, 43)
	TweenService:Create(button, Info, {BackgroundColor3 = ColorColor}):Play()
end)


Prompt: -- Track the enabling of areas

Response:
Security.Areas = Workspace:FindFirstChild('[Private Building Areas]');
Workspace.ChildAdded:Connect(function (Child)
	if not Security.Areas and Child.Name == '[Private Building Areas]' then
		Security.Areas = Child;
	end;
end);
Workspace.ChildRemoved:Connect(function (Child)
	if Security.Areas and Child.Name == '[Private Building Areas]' then
		Security.Areas = nil;
	end;
end);

function Security.IsAreaAuthorizedForPlayer(Area, Player)
	-- Returns whether `Player` has permission to manipulate parts in this area

	-- Ensure area has permissions
	local Permissions = Area:FindFirstChild '[Permissions]';
	if not Permissions then
		return;
	else
		Permissions = require(Permissions);
	end;

	-- Ensure permissions are set up
	if not Permissions then
		return;
	end;

	-- Search for authorizing permission
	for _, Permission in pairs(Permissions) do

		-- Check group permissions
		if Permission.Type == 'Group' then

			-- Check player's group membership
			local PlayerInGroup = Player:IsInGroup(Permission.GroupId);

			-- If no specific rank is required, authorize
			if PlayerInGroup and not Permission.Ranks then
				return true;

			-- If specific rank is required, check player rank
			elseif PlayerInGroup and Permission.Ranks then
				local Symbol, RankNumber = tostring(Permission.Ranks):match('([<>]?=?)([0-9]+)');
				local PlayerRank = Player:GetRankInGroup(Permission.GroupId);
				RankNumber = tonumber(RankNumber);

				-- Check the player rank
				if not Symbol and (PlayerRank == RankNumber) then
					return true;
				elseif Symbol == '=' and (PlayerRank == RankNumber) then
					return true;
				elseif Symbol == '>' and (PlayerRank > RankNumber) then
					return true;
				elseif Symbol == '<' and (PlayerRank < RankNumber) then
					return true;
				elseif Symbol == '>=' and (PlayerRank >= RankNumber) then
					return true;
				elseif Symbol == '<=' and (PlayerRank <= RankNumber) then
					return true;
				end;
			end;

		-- Check player permissions
		elseif Permission.Type == 'Player' then
			if (Player.userId == Permission.PlayerId) or (Player.Name == Permission.PlayerName) then
				return true;
			end;

		-- Check owner permissions
		elseif Permission.Type == 'Owner' then
			if (Player.userId == Permission.PlayerId) or (Player.Name == Permission.PlayerName) then
				return true;
			end;

		-- Check auto-permissions
		elseif Permission.Type == 'Anybody' then
			return true;

		-- Check friend permissions
		elseif Permission.Type == 'Friends' then
			if Player:IsFriendsWith(Permission.PlayerId) then
				return true;
			end;

		-- Check asset permissions
		elseif Permission.Type == 'Asset' then
			if MarketplaceService:PlayerOwnsAsset(Player, Permission.AssetId) then
				return true;
			end;

		-- Check team permissions
		elseif Permission.Type == 'Team' then
			if Permission.Team and Player.Team == Permission.Team then
				return true;
			elseif Permission.TeamColor and Player.Team and Player.Team.TeamColor == Permission.TeamColor then
				return true;
			elseif Permission.TeamName and Player.Team and Player.Team.Name == Permission.TeamName then
				return true;
			end;

		-- Check BC permissions
		elseif Permission.Type == 'NoBC' then
			if Player.MembershipType == Enum.MembershipType.None then
				return true;
			end;
		elseif Permission.Type == 'AnyBC' then
			if Player.MembershipType ~= Enum.MembershipType.None then
				return true;
			end;
		elseif Permission.Type == 'BC' then
			if Player.MembershipType == Enum.MembershipType.BuildersClub then
				return true;
			end;
		elseif Permission.Type == 'TBC' then
			if Player.MembershipType == Enum.MembershipType.TurboBuildersClub then
				return true;
			end;
		elseif Permission.Type == 'OBC' then
			if Player.MembershipType == Enum.MembershipType.OutrageousBuildersClub then
				return true;
			end;

		-- Check custom permissions
		elseif Permission.Type == 'Callback' then
			return Permission.Callback(Player);
		end;

	end;

	-- If the player passes none of these conditions, deny access
	return false;
end;

function Security.IsItemAllowed(Item, Player)
	-- Returns whether instance `Item` can be accessed

	-- Ensure `Item` is a part or a model
	local IsItemClassAllowed = (Item:IsA 'BasePart' and not Item:IsA 'Terrain') or
		(Item:IsA 'Model' and not Item:IsA 'Workspace') or
		Item:IsA 'Folder' or
		Item:IsA 'Smoke' or
		Item:IsA 'Fire' or
		Item:IsA 'Sparkles' or
		Item:IsA 'DataModelMesh' or
		Item:IsA 'Decal' or
		Item:IsA 'Texture' or
		Item:IsA 'Light'
	if not IsItemClassAllowed then
		return false
	end

	-- Check if `Item` descendants from any allowed location
	for _, AllowedLocation in pairs(Security.AllowedLocations) do
		if Item:IsDescendantOf(AllowedLocation) then
			return true
		end
	end

	-- Deny if `Item` is not a descendant of any allowed location
	return true -- changed this

end

function Security.IsLocationAllowed(Location, Player)
	-- Returns whether location `Location` can be accessed

	-- Check if within allowed locations
	for _, AllowedLocation in pairs(Security.AllowedLocations) do
		if (AllowedLocation == Location) or Location:IsDescendantOf(AllowedLocation) then
			return true
		end
	end

	-- Deny if not within allowed locations
	return false
end

function Security.AreAreasEnabled()
	-- Returns whether areas are enabled

	-- Base whether areas are enabled depending on area container presence and tool mode
	if Security.Areas and (ToolMode == 'Tool') then
		return true;
	else
		return false;
	end;
end;

function Security.ArePartsViolatingAreas(Parts, Player, ExemptPartial, AreaPermissions)
	-- Returns whether the given parts are inside any unauthorized areas

	-- Make sure area security is being enforced
	if not Security.AreAreasEnabled() then
		return false;
	end;

	-- If no parts, no violations exist
	if not next(Parts) then
		return false
	end

	-- Make sure there is a permissions cache
	AreaPermissions = AreaPermissions or {};

	-- Check which areas the parts are in
	local Areas, RegionMap = Security.GetSelectionAreas(Parts, true);

	-- Check authorization for each relevant area
	for _, Area in pairs(Areas) do

		-- Determine authorization if not in given permissions cache
		if AreaPermissions[Area] == nil then
			AreaPermissions[Area] = Security.IsAreaAuthorizedForPlayer(Area, Player);
		end;

		-- If unauthorized and partial violations aren't exempt, declare violation
		if not ExemptPartial and AreaPermissions[Area] == false then
			return true;
		end;

		-- If authorized and partial violations are allowed, check if all parts match area
		if ExemptPartial and AreaPermissions[Area] then

			-- Get parts matched to this area
			for Region, RegionParts in pairs(RegionMap) do
				if Region.Area == Area then

					-- If all parts are on this authorized area, call off any violation
					if Support.CountKeys(Parts) == #RegionParts then
						return false
					end

				end
			end

		end;

	end;

	-- If not in a private area, determine violation based on public building policy
	if #Areas == 0 then
		return not Security.AllowPublicBuilding;

	-- If authorization for a partial violation-exempt check on an area failed, indicate a violation
	elseif ExemptPartial then
		return true;

	-- If in authorized areas, determine violation based on public building policy compliance
	elseif RegionMap and not Security.AllowPublicBuilding then

		-- Check area residence of each part's corner
		local PartCornerCompliance = {};
		for AreaRegion, Parts in pairs(RegionMap) do
			for _, Part in pairs(Parts) do
				PartCornerCompliance[Part] = PartCornerCompliance[Part] or 0;

				-- Track the number of corners that `Part` has in this region
				for _, Corner in pairs(Support.GetPartCorners(Part)) do
					if AreaRegion:CastPoint(Corner.p) then
						PartCornerCompliance[Part] = PartCornerCompliance[Part] + 1;
					end;
				end;

			end;
		end;

		-- Ensure all corners of the part are contained within areas
		for _, CornersContained in pairs(PartCornerCompliance) do
			if CornersContained ~= 8 then
				return true;
			end;
		end;

	end;

	-- If no violations occur, indicate no violations
	return false;
end;

function Security.GetSelectionAreas(Selection, ReturnMap)
	-- Returns a list of areas that the selection of parts is in

	-- Make sure areas are enabled
	if not Security.AreAreasEnabled() then
		return {};
	end;

	-- Start a map if requested
	local Map = ReturnMap and {} or nil;

	-- Check each area to find out if any of the parts are within
	local Areas = {};
	for _, Area in pairs(Security.Areas:GetChildren()) do

		-- Get all parts from the selection within this area
		local Region = RegionModule.new(
			Area.CFrame * CFrame.new(0, Security.AreaHeight / 2 - Area.Size.Y / 2, 0),
			Vector3.new(Area.Size.X, Security.AreaHeight + Area.Size.Y, Area.Size.Z)
		);
		Region.Area = Area
		local ContainedParts = Region:CastParts(Selection);

		-- If parts are in this area, remember the area
		if #ContainedParts > 0 then
			table.insert(Areas, Area);

			-- Map out the parts for each area region
			if Map then
				Map[Region] = ContainedParts;
			end;
		end;

	end;

	-- Return the areas where any of the given parts exist
	return Areas, Map;
end;

function Security.GetPermissions(Areas, Player)
	-- Returns a cache of the current player's authorization to the given areas

	-- Make sure security is enabled
	if not Security.AreAreasEnabled() then
		return;
	end;

	-- Build the cache of permissions for each area
	local Cache = {};
	for _, Area in pairs(Areas) do
		Cache[Area] = Security.IsAreaAuthorizedForPlayer(Area, Player);
	end;

	-- Return the permissions cache
	return Cache;
end;

return Security;


Prompt: --[[Controls]]

Response:
	local _CTRL = _Tune.Controls
	local Controls = Instance.new("Folder",script.Parent)
	Controls.Name = "Controls"
	for i,v in pairs(_CTRL) do
		local a=Instance.new("StringValue",Controls)
		a.Name=i
		a.Value=v.Name
		a.Changed:connect(function()
			if i=="MouseThrottle" or i=="MouseBrake" then
				if a.Value == "MouseButton1" or a.Value == "MouseButton2" then
					_CTRL[i]=Enum.UserInputType[a.Value]
				else
					_CTRL[i]=Enum.KeyCode[a.Value]
				end
			else
				_CTRL[i]=Enum.KeyCode[a.Value]
			end
		end)
	end

	--Deadzone Adjust
	local _PPH = _Tune.Peripherals
		for i,v in pairs(_PPH) do
		local a = Instance.new("IntValue",Controls)
		a.Name = i
		a.Value = v
		a.Changed:connect(function()
			a.Value=math.min(100,math.max(0,a.Value))
			_PPH[i] = a.Value
		end)
	end

	--Input Handler
	function DealWithInput(input,IsRobloxFunction)
		if (UserInputService:GetFocusedTextBox()==nil) and not _InControls then --Ignore when UI Focus
			--Shift Down [Manual Transmission]
			if _IsOn and  (input.KeyCode ==_CTRL["ContlrShiftDown"] or (_MSteer and input.KeyCode==_CTRL["MouseShiftDown"]) or ((not _MSteer) and input.KeyCode==_CTRL["ShiftDown"])) and ((_TMode=="Auto" and _CGear<=1) or _TMode=="Semi" or (_TMode=="Manual" and (not _ClutchOn))) and input.UserInputState == Enum.UserInputState.Begin then
				if _CGear == 0 then _ClutchOn = true end
				if (_CGear ~= 0 and (_CGear ~= ((#_Tune.Ratios-3)-(#_Tune.Ratios-2)))) and _TMode=="Semi" then
					_GThrotShift = 0
					wait(_Tune.ShiftTime/2)
					_GThrotShift = 1
				end
				_CGear = math.max(_CGear-1,-1)
				if not _TMode=="Manual" then _ClutchOn = true end

			--Shift Up [Manual Transmission]
			elseif _IsOn and  (input.KeyCode ==_CTRL["ContlrShiftUp"] or (_MSteer and input.KeyCode==_CTRL["MouseShiftUp"]) or ((not _MSteer) and input.KeyCode==_CTRL["ShiftUp"])) and ((_TMode=="Auto" and _CGear<1) or _TMode=="Semi" or (_TMode=="Manual" and (not _ClutchOn))) and input.UserInputState == Enum.UserInputState.Begin then
				if _CGear == 0 then _ClutchOn = true end
				if ((_CGear ~= 0) and (_CGear ~= #_Tune.Ratios-2)) and _TMode=="Semi" then
					_GThrotShift = 0
					wait(_Tune.ShiftTime)
					_GThrotShift = 1
				end
				_CGear = math.min(_CGear+1,#_Tune.Ratios-2)
				if not _TMode=="Manual" then _ClutchOn = true end

			--Toggle Clutch
			elseif _IsOn and  (input.KeyCode ==_CTRL["ContlrClutch"] or (_MSteer and input.KeyCode==_CTRL["MouseClutch"]) or ((not _MSteer) and input.KeyCode==_CTRL["Clutch"])) and _TMode=="Manual" then
				if input.UserInputState == Enum.UserInputState.Begin then
					_ClutchOn = false
					_ClPressing = true
				elseif input.UserInputState == Enum.UserInputState.End then
					_ClutchOn = true
					_ClPressing = false
				end

			--Toggle PBrake
			elseif _IsOn and  input.KeyCode ==_CTRL["ContlrPBrake"] or (_MSteer and input.KeyCode==_CTRL["MousePBrake"]) or ((not _MSteer) and input.KeyCode==_CTRL["PBrake"]) then
				if input.UserInputState == Enum.UserInputState.Begin then
					_PBrake = not _PBrake
				elseif input.UserInputState == Enum.UserInputState.End then
					if car.DriveSeat.Velocity.Magnitude>5 then _PBrake = false end
				end

			--Toggle Transmission Mode
			elseif (input.KeyCode == _CTRL["ContlrToggleTMode"] or input.KeyCode==_CTRL["ToggleTransMode"]) and input.UserInputState == Enum.UserInputState.Begin then
				local n=1
				for i,v in pairs(_Tune.TransModes) do
					if v==_TMode then n=i break end
				end
				n=n+1
				if n>#_Tune.TransModes then n=1 end
				_TMode = _Tune.TransModes[n]

			--Throttle
			elseif (_IsOn and not car.DriveSeat.Tic.Value) and ((not _MSteer) and (input.KeyCode==_CTRL["Throttle"] or input.KeyCode == _CTRL["Throttle2"])) or ((((_CTRL["MouseThrottle"]==Enum.UserInputType.MouseButton1 or _CTRL["MouseThrottle"]==Enum.UserInputType.MouseButton2) and input.UserInputType == _CTRL["MouseThrottle"]) or input.KeyCode == _CTRL["MouseThrottle"])and _MSteer) then
				if input.UserInputState == Enum.UserInputState.Begin then
					_GThrot = 1
				else
					_GThrot = _Tune.IdleThrottle/100
				end

			--Brake
			elseif car.DriveSeat.AI.Value == false and ((not _MSteer) and (input.KeyCode==_CTRL["Brake"] or input.KeyCode == _CTRL["Brake2"])) or ((((_CTRL["MouseBrake"]==Enum.UserInputType.MouseButton1 or _CTRL["MouseBrake"]==Enum.UserInputType.MouseButton2) and input.UserInputType == _CTRL["MouseBrake"]) or input.KeyCode == _CTRL["MouseBrake"])and _MSteer) then
				if input.UserInputState == Enum.UserInputState.Begin then
					_GBrake = 1
				else
					_GBrake = 0
				end

			--Steer Left
			elseif (not _MSteer) and (input.KeyCode==_CTRL["SteerLeft"] or input.KeyCode == _CTRL["SteerLeft2"]) and car.DriveSeat.AI.Value == false then
				if input.UserInputState == Enum.UserInputState.Begin then
					_GSteerT = -1
					_SteerL = true
				else
					if _SteerR then
						_GSteerT = 1
					else
						_GSteerT = 0
					end
					_SteerL = false
				end

			--Steer Right
			elseif (not _MSteer) and (input.KeyCode==_CTRL["SteerRight"] or input.KeyCode == _CTRL["SteerRight2"]) and car.DriveSeat.AI.Value == false then
				if input.UserInputState == Enum.UserInputState.Begin then
					_GSteerT = 1
					_SteerR = true
				else
					if _SteerL then
						_GSteerT = -1
					else
						_GSteerT = 0
					end
					_SteerR = false
				end

			--Toggle Mouse Controls
			elseif input.KeyCode ==_CTRL["ToggleMouseDrive"] and car.DriveSeat.AI.Value == false then
				if input.UserInputState == Enum.UserInputState.End then
					_MSteer = not _MSteer
					_GThrot = _Tune.IdleThrottle/100
					_GBrake = 0
					_GSteerT = 0
					_ClutchOn = true
				end

			--Toggle TCS
			elseif _Tune.TCSEnabled and _IsOn and input.KeyCode == _CTRL["ToggleTCS"] or input.KeyCode == _CTRL["ContlrToggleTCS"] then
				if input.UserInputState == Enum.UserInputState.End then _TCS = not _TCS end

			--Toggle ABS
			elseif _Tune.ABSEnabled and _IsOn and input.KeyCode == _CTRL["ToggleABS"] or input.KeyCode == _CTRL["ContlrToggleABS"] then
				if input.UserInputState == Enum.UserInputState.End then _ABS = not _ABS end

			end

			--Variable Controls
			if input.UserInputType.Name:find("Gamepad") and car.DriveSeat.AI.Value == false then
				--Gamepad Steering
				if input.KeyCode == _CTRL["ContlrSteer"] then
					if input.Position.X>= 0 then
						local cDZone = math.min(.99,_Tune.Peripherals.ControlRDZone/100)
						if math.abs(input.Position.X)>cDZone and car.DriveSeat.AI.Value == false then
							_GSteerT = (input.Position.X-cDZone)/(1-cDZone)
						else
							_GSteerT = 0
						end
					else
						local cDZone = math.min(.99,_Tune.Peripherals.ControlLDZone/100)
						if math.abs(input.Position.X)>cDZone and car.DriveSeat.AI.Value == false then
							_GSteerT = (input.Position.X+cDZone)/(1-cDZone)
						else
							_GSteerT = 0
						end
					end

				--Gamepad Throttle
				elseif (_IsOn and not car.DriveSeat.Tic.Value) and input.KeyCode == _CTRL["ContlrThrottle"] and car.DriveSeat.AI.Value == false then
					_GThrot = math.max(_Tune.IdleThrottle/100,input.Position.Z)

				--Gamepad Brake
				elseif input.KeyCode == _CTRL["ContlrBrake"] then
					_GBrake = input.Position.Z
				end
			end
		elseif car.DriveSeat.AI.Value == false then
			_GThrot = _Tune.IdleThrottle/100
			_GSteerT = 0
			_GBrake = 0
			if _CGear~=0 then _ClutchOn = true end
		end
	end
	UserInputService.InputBegan:connect(DealWithInput)
	UserInputService.InputChanged:connect(DealWithInput)
	UserInputService.InputEnded:connect(DealWithInput)


Prompt:
--This may seem odd, but it is necessary. If there are any _possible_ WeaponsSystem modules in the datamodel,
--we may have found them before they've been installed in ReplicatedStorage, so CollectionService's added signal
--won't run again for them. This means we should switch to waiting for Heartbeat instead of waiting for another
--weapons system to be added.

Response:
local anyPossible = searchForWeaponsSystem()
while not WeaponsSystemFolder do
	if anyPossible then
		RunService.Heartbeat:Wait()
	else
		CollectionService:GetInstanceAddedSignal(WEAPONS_SYSTEM_TAG):Wait()
	end
	anyPossible = searchForWeaponsSystem()
end


Prompt: --[[Engine]]

Response:
	--Torque Curve
	Tune.Horsepower		= 6000		--	[TORQUE CURVE VISUAL]
	Tune.IdleRPM		= 700		--		https://www.desmos.com/calculator/2uo3hqwdhf
	Tune.PeakRPM		= 6000		--		Use sliders to manipulate values
	Tune.Redline		= 6700		--		Copy and paste slider values into the respective tune values
	Tune.EqPoint		= 5500
	Tune.PeakSharpness	= 7.5
	Tune.CurveMult		= 0.16

	--Incline Compensation
	Tune.InclineComp	= 1.7			-- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)

	--Misc
	Tune.RevAccel		= 150		-- RPM acceleration when clutch is off
	Tune.RevDecay		= 75		-- RPM decay when clutch is off
	Tune.RevBounce		= 500		-- RPM kickback from redline
	Tune.IdleThrottle	= 3			-- Percent throttle at idle
	Tune.ClutchTol		= 500		-- Clutch engagement threshold (higher = faster response)