Prompt: -- Finalize changes to parts when the handle is let go

Response:
Support.AddUserInputListener('Ended', 'MouseButton1', true, function (Input)

	-- Make sure rotating is ongoing
	if not HandleRotating then
		return;
	end;

	-- Prevent selection
	Core.Targeting.CancelSelecting();

	-- Disable rotating
	HandleRotating = false;

	-- Clear this connection to prevent it from firing again
	ClearConnection 'HandleRelease';

	-- Clear change indicator states
	HandleDirection = nil;
	HandleFirstAngle = nil;
	LastDisplayedRotation = nil;

	-- Make joints, restore original anchor and collision states
	for Part, State in pairs(InitialState) do
		Part:MakeJoints();
		Core.RestoreJoints(State.Joints);
		Part.CanCollide = State.CanCollide;
		Part.Anchored = State.Anchored;
	end;

	-- Register the change
	RegisterChange();

	-- Resume normal bounding box updating
	BoundingBox.RecalculateStaticExtents();
	BoundingBox.ResumeMonitoring();

end);

function HideHandles()
	-- Hides the resizing handles

	-- Make sure handles exist and are visible
	if not Handles or not Handles.Visible then
		return;
	end;

	-- Hide the handles
	Handles.Visible = false;
	Handles.Parent = nil;

	-- Disable handle autofocus if enabled
	ClearConnection 'AutofocusHandle';

end;

function RotatePartsAroundPivot(PivotMode, PivotPoint, Axis, Rotation, InitialStates)
	-- Rotates the given parts in `InitialStates` around `PivotMode` (using `PivotPoint` if applicable)'s `Axis` by `Rotation`

	-- Create a CFrame that increments rotation by `Rotation` around `Axis`
	local RotationCFrame = CFrame.fromAxisAngle(Vector3.FromAxis(Axis), math.rad(Rotation));

	-- Rotate each part
	for Part, InitialState in pairs(InitialStates) do

		-- Rotate around the selection's center, or the currently focused part
		if PivotMode == 'Center' or PivotMode == 'Last' then

			-- Calculate the focused part's rotation
			local RelativeTo = PivotPoint * RotationCFrame;

			-- Calculate this part's offset from the focused part's rotation
			local Offset = PivotPoint:toObjectSpace(InitialState.CFrame);

			-- Rotate relative to the focused part by this part's offset from it
			Part.CFrame = RelativeTo * Offset;

		-- Rotate around the part's center
		elseif RotateTool.Pivot == 'Local' then
			Part.CFrame = InitialState.CFrame * RotationCFrame;

		end;

	end;

end;

function GetHandleDisplayDelta(HandleRotation)
	-- Returns a human-friendly version of the handle's rotation delta

	-- Prepare to capture first angle
	if HandleFirstAngle == nil then
		HandleFirstAngle = true;
		HandleDirection = true;

	-- Capture first angle
	elseif HandleFirstAngle == true then

		-- Determine direction based on first angle
		if math.abs(HandleRotation) > 180 then
			HandleDirection = false;
		else
			HandleDirection = true;
		end;

		-- Disable first angle capturing
		HandleFirstAngle = false;

	end;

	-- Determine the rotation delta to display
	local DisplayedRotation;
	if HandleDirection == true then
		DisplayedRotation = (360 - HandleRotation) % 360;
	else
		DisplayedRotation = HandleRotation % 360;
	end;

	-- Switch delta calculation direction if crossing directions
	if LastDisplayedRotation and (
	   (LastDisplayedRotation <= 120 and DisplayedRotation >= 240) or
	   (LastDisplayedRotation >= 240 and DisplayedRotation <= 120)) then
		HandleDirection = not HandleDirection;
	end;

	-- Update displayed rotation after direction correction
	if HandleDirection == true then
		DisplayedRotation = (360 - HandleRotation) % 360;
	else
		DisplayedRotation = HandleRotation % 360;
	end;

	-- Store this last display rotation
	LastDisplayedRotation = DisplayedRotation;

	-- Return updated display delta
	return DisplayedRotation;

end;

function BindShortcutKeys()
	-- Enables useful shortcut keys for this tool

	-- Track user input while this tool is equipped
	table.insert(Connections, UserInputService.InputBegan:connect(function (InputInfo, GameProcessedEvent)

		-- Make sure this is an intentional event
		if GameProcessedEvent then
			return;
		end;

		-- Make sure this input is a key press
		if InputInfo.UserInputType ~= Enum.UserInputType.Keyboard then
			return;
		end;

		-- Make sure it wasn't pressed while typing
		if UserInputService:GetFocusedTextBox() then
			return;
		end;

		-- Check if the enter key was pressed
		if InputInfo.KeyCode == Enum.KeyCode.Return or InputInfo.KeyCode == Enum.KeyCode.KeypadEnter then

			-- Toggle the current axis mode
			if RotateTool.Pivot == 'Center' then
				SetPivot('Local');

			elseif RotateTool.Pivot == 'Local' then
				SetPivot('Last');

			elseif RotateTool.Pivot == 'Last' then
				SetPivot('Center');
			end;

		-- Check if the - key was pressed
		elseif InputInfo.KeyCode == Enum.KeyCode.Minus or InputInfo.KeyCode == Enum.KeyCode.KeypadMinus then

			-- Focus on the increment input
			if RotateTool.UI then
				RotateTool.UI.IncrementOption.Increment.TextBox:CaptureFocus();
			end;

		-- Nudge around X axis if the 8 button on the keypad is pressed
		elseif InputInfo.KeyCode == Enum.KeyCode.KeypadEight then
			NudgeSelectionByAxis(Enum.Axis.X, 1);

		-- Nudge around X axis if the 2 button on the keypad is pressed
		elseif InputInfo.KeyCode == Enum.KeyCode.KeypadTwo then
			NudgeSelectionByAxis(Enum.Axis.X, -1);

		-- Nudge around Z axis if the 9 button on the keypad is pressed
		elseif InputInfo.KeyCode == Enum.KeyCode.KeypadNine then
			NudgeSelectionByAxis(Enum.Axis.Z, 1);

		-- Nudge around Z axis if the 1 button on the keypad is pressed
		elseif InputInfo.KeyCode == Enum.KeyCode.KeypadOne then
			NudgeSelectionByAxis(Enum.Axis.Z, -1);

		-- Nudge around Y axis if the 4 button on the keypad is pressed
		elseif InputInfo.KeyCode == Enum.KeyCode.KeypadFour then
			NudgeSelectionByAxis(Enum.Axis.Y, -1);

		-- Nudge around Y axis if the 6 button on the keypad is pressed
		elseif InputInfo.KeyCode == Enum.KeyCode.KeypadSix then
			NudgeSelectionByAxis(Enum.Axis.Y, 1);

		-- Start snapping when the R key is pressed down, and it's not the selection clearing hotkey
		elseif (InputInfo.KeyCode == Enum.KeyCode.R) and not Selection.Multiselecting then
			StartSnapping();

		-- Start snapping when T key is pressed down (alias)
		elseif InputInfo.KeyCode == Enum.KeyCode.T then
			StartSnapping();

		end;

	end));

end;

function StartSnapping()

	-- Make sure snapping isn't already enabled
	if SnapTracking.Enabled then
		return;
	end;

	-- Listen for snapped points
	SnapTracking.StartTracking(function (NewPoint)
		SnappedPoint = NewPoint;
	end);

	-- Select the snapped pivot point upon clicking
	Connections.SelectSnappedPivot = Core.Mouse.Button1Down:connect(function ()

		-- Disable unintentional selection
		Core.Targeting.CancelSelecting();

		-- Ensure there is a snap point
		if not SnappedPoint then
			return;
		end;

		-- Disable snapping
		SnapTracking.StopTracking();

		-- Attach the handles to a part at the snapped point
		local Part = Create 'Part' {
			CFrame = SnappedPoint,
			Size = Vector3.new(5, 1, 5)
		};
		SetPivot 'Last';
		AttachHandles(Part, true);

		-- Maintain the part in memory to prevent garbage collection
		GCBypass = { Part };

		-- Set the pivot point
		PivotPoint = SnappedPoint;
		CustomPivotPoint = true;

		-- Disconnect snapped pivot point selection listener
		ClearConnection 'SelectSnappedPivot';

		-- Disable custom pivot point mode when the handles attach elsewhere
		DisableCustomPivotPoint = Handles.Changed:Connect(function (Property)
			if Property == 'Adornee' then
				CustomPivotPoint = false;
				DisableCustomPivotPoint:Disconnect();
			end;
		end);

	end);

end;

function SetAxisAngle(Axis, Angle)
	-- Sets the selection's angle on axis `Axis` to `Angle`

	-- Turn the given angle from degrees to radians
	local Angle = math.rad(Angle);

	-- Track this change
	TrackChange();

	-- Prepare parts to be moved
	local InitialStates = PreparePartsForRotating();

	-- Update each part
	for Part, State in pairs(InitialStates) do

		-- Set the part's new CFrame
		Part.CFrame = CFrame.new(Part.Position) * CFrame.fromOrientation(
			Axis == 'X' and Angle or math.rad(Part.Orientation.X),
			Axis == 'Y' and Angle or math.rad(Part.Orientation.Y),
			Axis == 'Z' and Angle or math.rad(Part.Orientation.Z)
		);

	end;

	-- Cache up permissions for all private areas
	local AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Selection.Items), Core.Player);

	-- Revert changes if player is not authorized to move parts to target destination
	if Core.Mode == 'Tool' and Security.ArePartsViolatingAreas(Selection.Items, Core.Player, false, AreaPermissions) then
		for Part, State in pairs(InitialStates) do
			Part.CFrame = State.CFrame;
		end;
	end;

	-- Restore the parts' original states
	for Part, State in pairs(InitialStates) do
		Part:MakeJoints();
		Core.RestoreJoints(State.Joints);
		Part.CanCollide = State.CanCollide;
		Part.Anchored = State.Anchored;
	end;

	-- Register the change
	RegisterChange();

end;

function NudgeSelectionByAxis(Axis, Direction)
	-- Nudges the rotation of the selection in the direction of the given axis

	-- Ensure selection is not empty
	if #Selection.Items == 0 then
		return;
	end;

	-- Get amount to nudge by
	local NudgeAmount = RotateTool.Increment;

	-- Reverse nudge amount if shift key is held while nudging
	local PressedKeys = Support.FlipTable(Support.GetListMembers(UserInputService:GetKeysPressed(), 'KeyCode'));
	if PressedKeys[Enum.KeyCode.LeftShift] or PressedKeys[Enum.KeyCode.RightShift] then
		NudgeAmount = -NudgeAmount;
	end;

	-- Track the change
	TrackChange();

	-- Stop parts from moving, and capture the initial state of the parts
	local InitialState = PreparePartsForRotating();

	-- Set the pivot point to the center of the selection if in Center mode
	if RotateTool.Pivot == 'Center' then
		local BoundingBoxSize, BoundingBoxCFrame = BoundingBox.CalculateExtents(Selection.Items);
		PivotPoint = BoundingBoxCFrame;

	-- Set the pivot point to the center of the focused part if in Last mode
	elseif RotateTool.Pivot == 'Last' and not CustomPivotPoint then
		PivotPoint = InitialState[Selection.Focus].CFrame;
	end;

	-- Perform the rotation
	RotatePartsAroundPivot(RotateTool.Pivot, PivotPoint, Axis, NudgeAmount * (Direction or 1), InitialState);

	-- Update the "degrees rotated" indicator
	if RotateTool.UI then
		RotateTool.UI.Changes.Text.Text = 'rotated ' .. (NudgeAmount * (Direction or 1)) .. ' degrees';
	end;

	-- Cache area permissions information
	local AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Selection.Items), Core.Player);

	-- Make sure we're not entering any unauthorized private areas
	if Core.Mode == 'Tool' and Security.ArePartsViolatingAreas(Selection.Items, Core.Player, false, AreaPermissions) then
		for Part, State in pairs(InitialState) do
			Part.CFrame = State.CFrame;
		end;
	end;

	-- Make joints, restore original anchor and collision states
	for Part, State in pairs(InitialState) do
		Part:MakeJoints();
		Core.RestoreJoints(State.Joints);
		Part.CanCollide = State.CanCollide;
		Part.Anchored = State.Anchored;
	end;

	-- Register the change
	RegisterChange();

end;

function TrackChange()

	-- Start the record
	HistoryRecord = {
		Parts = Support.CloneTable(Selection.Items);
		BeforeCFrame = {};
		AfterCFrame = {};

		Unapply = function (Record)
			-- Reverts this change

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

			-- Put together the change request
			local Changes = {};
			for _, Part in pairs(Record.Parts) do
				table.insert(Changes, { Part = Part, CFrame = Record.BeforeCFrame[Part] });
			end;

			-- Send the change request
			Core.SyncAPI:Invoke('SyncRotate', Changes);

		end;

		Apply = function (Record)
			-- Applies this change

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

			-- Put together the change request
			local Changes = {};
			for _, Part in pairs(Record.Parts) do
				table.insert(Changes, { Part = Part, CFrame = Record.AfterCFrame[Part] });
			end;

			-- Send the change request
			Core.SyncAPI:Invoke('SyncRotate', Changes);

		end;

	};

	-- Collect the selection's initial state
	for _, Part in pairs(HistoryRecord.Parts) do
		HistoryRecord.BeforeCFrame[Part] = Part.CFrame;
	end;

end;

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

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

	-- Collect the selection's final state
	local Changes = {};
	for _, Part in pairs(HistoryRecord.Parts) do
		HistoryRecord.AfterCFrame[Part] = Part.CFrame;
		table.insert(Changes, { Part = Part, CFrame = Part.CFrame });
	end;

	-- Send the change to the server
	Core.SyncAPI:Invoke('SyncRotate', Changes);

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

end;

function PreparePartsForRotating()
	-- Prepares parts for rotating and returns the initial state of the parts

	local InitialState = {};

	-- Get index of parts
	local PartIndex = Support.FlipTable(Selection.Items);

	-- Stop parts from moving, and capture the initial state of the parts
	for _, Part in pairs(Selection.Items) do
		InitialState[Part] = { Anchored = Part.Anchored, CanCollide = Part.CanCollide, CFrame = Part.CFrame };
		Part.Anchored = true;
		Part.CanCollide = false;
		InitialState[Part].Joints = Core.PreserveJoints(Part, PartIndex);
		Part:BreakJoints();
		Part.Velocity = Vector3.new();
		Part.RotVelocity = Vector3.new();
	end;

	return InitialState;
end;

function GetIncrementMultiple(Number, Increment)

	-- Get how far the actual distance is from a multiple of our increment
	local MultipleDifference = Number % Increment;

	-- Identify the closest lower and upper multiples of the increment
	local LowerMultiple = Number - MultipleDifference;
	local UpperMultiple = Number - MultipleDifference + Increment;

	-- Calculate to which of the two multiples we're closer
	local LowerMultipleProximity = math.abs(Number - LowerMultiple);
	local UpperMultipleProximity = math.abs(Number - UpperMultiple);

	-- Use the closest multiple of our increment as the distance moved
	if LowerMultipleProximity <= UpperMultipleProximity then
		Number = LowerMultiple;
	else
		Number = UpperMultiple;
	end;

	return Number;
end;


Prompt:
--[[ @brief Reshuffles the heap if a given index is larger than one of its children.
--]]

Response:
function Heap:_HeapifyTopDown(i)
	local l = i * 2;
	local r = l + 1;
	local largest;
	if l <= #self and self.Comparator(self[l], self[i]) then
		largest = l;
	else
		largest = i;
	end
	if r <= #self and self.Comparator(self[r], self[largest]) then
		largest = r;
	end
	if largest ~= i then
		self[i], self[largest] = self[largest], self[i];
		self:_HeapifyTopDown(largest);
	end
end


Response:
function DoorClose()
	if Shaft00.MetalDoor.CanCollide == false then
		Shaft00.MetalDoor.CanCollide = true
		while Shaft00.MetalDoor.Transparency > 0.0 do
			Shaft00.MetalDoor.Transparency = Shaft00.MetalDoor.Transparency - .1
			wait(0.000001)
		end
		Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)	--Change 10 to change the speed.
	end
	if Shaft01.MetalDoor.CanCollide == false then
		Shaft01.MetalDoor.CanCollide = true
		while Shaft01.MetalDoor.Transparency > 0.0 do
			Shaft01.MetalDoor.Transparency = Shaft01.MetalDoor.Transparency - .1
			wait(0.000001)
		end
		Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)
	end
	if Shaft02.MetalDoor.CanCollide == false then
		Shaft02.MetalDoor.CanCollide = true
		while Shaft02.MetalDoor.Transparency > 0.0 do
			Shaft02.MetalDoor.Transparency = Shaft02.MetalDoor.Transparency - .1
			wait(0.000001)
		end
		Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)
	end
	if Shaft03.MetalDoor.CanCollide == false then
		Shaft03.MetalDoor.CanCollide = true
		while Shaft03.MetalDoor.Transparency > 0.0 do
			Shaft03.MetalDoor.Transparency = Shaft03.MetalDoor.Transparency - .1
			wait(0.000001)
		end
		Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)
	end
	if Shaft04.MetalDoor.CanCollide == false then
		Shaft04.MetalDoor.CanCollide = true
		while Shaft04.MetalDoor.Transparency > 0.0 do
			Shaft04.MetalDoor.Transparency = Shaft04.MetalDoor.Transparency - .1
			wait(0.000001)
		end
		Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)
	end
	if Shaft05.MetalDoor.CanCollide == false then
		Shaft05.MetalDoor.CanCollide = true
		while Shaft05.MetalDoor.Transparency > 0.0 do
			Shaft05.MetalDoor.Transparency = Shaft05.MetalDoor.Transparency - .1
			wait(0.000001)
		end
		Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)
	end
	if Shaft06.MetalDoor.CanCollide == false then
		Shaft06.MetalDoor.CanCollide = true
		while Shaft06.MetalDoor.Transparency > 0.0 do
			Shaft06.MetalDoor.Transparency = Shaft06.MetalDoor.Transparency - .1
			wait(0.000001)
		end

	end
	if Shaft07.MetalDoor.CanCollide == false then
		Shaft07.MetalDoor.CanCollide = true
		while Shaft07.MetalDoor.Transparency > 0.0 do
			Shaft07.MetalDoor.Transparency = Shaft07.MetalDoor.Transparency - .1
			wait(0.000001)
		end
		Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
	end
	if Shaft08.MetalDoor.CanCollide == false then
		Shaft08.MetalDoor.CanCollide = true
		while Shaft08.MetalDoor.Transparency > 0.0 do
			Shaft08.MetalDoor.Transparency = Shaft08.MetalDoor.Transparency - .1
			wait(0.000001)
		end
		Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
	end
	if Shaft09.MetalDoor.CanCollide == false then
		Shaft09.MetalDoor.CanCollide = true
		while Shaft09.MetalDoor.Transparency > 0.0 do
			Shaft09.MetalDoor.Transparency = Shaft09.MetalDoor.Transparency - .1
			wait(0.000001)
		end
		Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
	end
	if Shaft10.MetalDoor.CanCollide == false then
		Shaft10.MetalDoor.CanCollide = true
		while Shaft10.MetalDoor.Transparency > 0.0 do
			Shaft10.MetalDoor.Transparency = Shaft10.MetalDoor.Transparency - .1
			wait(0.000001)
		end
		Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
	end
	if Shaft11.MetalDoor.CanCollide == false then
		Shaft11.MetalDoor.CanCollide = true
		while Shaft11.MetalDoor.Transparency > 0.0 do
			Shaft11.MetalDoor.Transparency = Shaft11.MetalDoor.Transparency - .1
			wait(0.000001)
		end
		Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
	end
	if Shaft12.MetalDoor.CanCollide == false then
		Shaft12.MetalDoor.CanCollide = true
		while Shaft12.MetalDoor.Transparency > 0.0 do
			Shaft12.MetalDoor.Transparency = Shaft12.MetalDoor.Transparency - .1
			wait(0.000001)
		end
		Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
	end
	if Shaft13.MetalDoor.CanCollide == false then
		Shaft13.MetalDoor.CanCollide = true
		while Shaft13.MetalDoor.Transparency > 0.0 do
			Shaft13.MetalDoor.Transparency = Shaft13.MetalDoor.Transparency - .1
			wait(0.000001)
		end
		Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
	end
end

function onClicked()
DoorClose()

end

script.Parent.MouseButton1Click:connect(onClicked)

script.Parent.MouseButton1Click:connect(function()
	if clicker == true
		then clicker = false
	else
		return

	end
end)

script.Parent.MouseButton1Click:connect(function()
Car.Touched:connect(function(otherPart)
	if otherPart == Elevator.Floors:FindFirstChild(script.Parent.Name)
		then StopE() DoorOpen()
	end
end)end)

function StopE()
 Car.BodyVelocity.velocity = Vector3.new(0, 0, 0)
 Car.BodyPosition.position = Elevator.Floors:FindFirstChild(script.Parent.Name).Position
	clicker = true
end

function DoorOpen()
	while Shaft06.MetalDoor.Transparency < 1.0 do
	Shaft06.MetalDoor.Transparency = Shaft06.MetalDoor.Transparency + .1
	wait(0.000001)
	end
	Shaft06.MetalDoor.CanCollide = false
end


Prompt:
--[=[
	@param defaultFn () -> any
	@return value: any
	If the option holds a value, returns the value. Otherwise, returns the
	result of the `defaultFn` function.
]=]

Response:
function Option:UnwrapOrElse(defaultFn)
	if self:IsSome() then
		return self:Unwrap()
	else
		return defaultFn()
	end
end


Response:
local _WHEELTUNE = {
																		--[[
			SS6 Presets
	[Eco]
		WearSpeed = 1,
		TargetFriction = .7,
		MinFriction = .1,
	[Road]
		WearSpeed = 2,
		TargetFriction = .7,
		MinFriction = .1,
	[Sport]
		WearSpeed = 3,
		TargetFriction = .79,
		MinFriction = .1,											]]

	TireWearOn 		= true	,

	--Friction and Wear
	FWearSpeed		=  3 	,
	FTargetFriction	= .5	,
	FMinFriction 	= .1	,

	RWearSpeed		=  3 	,
	RTargetFriction	= .5	,
	RMinFriction	= .1	,

	--Tire Slip
	TCSOffRatio		= 1/3	,
	WheelLockRatio	= 1/2	,	--SS6 Default = 1/4
	WheelspinRatio	= 1/1.1	,	--SS6 Default = 1/1.2

	--Wheel Properties
	FFrictionWeight	= 1		,	--SS6 Default = 1
	RFrictionWeight	= 1		,	--SS6 Default = 1
	FLgcyFrWeight	= 10	,
	RLgcyFrWeight	= 10	,

	FElasticity		= .5		,	--SS6 Default = .5
	RElasticity		= .5		,	--SS6 Default = .5
	FLgcyElasticity	= 0		,
	RLgcyElasticity	= 0		,

	FElastWeight	= 1		,	--SS6 Default = 1
	RElastWeight	= 1		,	--SS6 Default = 1
	FLgcyElWeight	= 10	,
	RLgcyElWeight	= 10	,

	--Wear Regen
	RegenSpeed		= 3.6		--SS6 Default = 3.6
}


Prompt: -- Welcome to the variable museum:

Response:
local player = script.Parent.Parent.Parent
local plane,mainParts,animationParts,info,main,move,gryo,seat,landingGear,accel,canCrash,crashForce,crashSpin,crashVisual,maxBank,maxSpeed,speedVary,stallSpeed,throttleInc,altRestrict,altMin,altMax,altSet
local desiredSpeed,currentSpeed,realSpeed = 0,0,0
local mouseSave
local gearParts = {}
local selected,flying,on,dead,gear,throttle = false,false,false,false,true,0
local gui = script.Parent.PlaneGui:clone()
local panel = gui.Panel
local lowestPoint = 0
local A = math.abs	-- Creating a shortcut for the function

local keys = {
	engine={key};
	landing = {key};
	spdup={byte=0;down=false};
	spddwn={byte=0;down=false};
}

function waitFor(parent,array)	-- Backup system to wait for objects to 'load'
	if (array) then
		for _,name in pairs(array) do
			while (not parent:findFirstChild(name)) do wait() end	-- If the object is found right away, no time will be spent waiting. That's why 'while' loops work better than 'repeat' in this case
		end
	elseif (parent:IsA("ObjectValue")) then
		while (not parent.Value) do wait() end
	end
end

function fixVars()	-- Correct your mistakes to make sure the plane still flies correctly!
	maxBank = (maxBank < -90 and -90 or maxBank > 90 and 90 or maxBank)
	throttleInc = (throttleInc < 0.01 and 0.01 or throttleInc > 1 and 1 or throttleInc)
	stallSpeed = (stallSpeed > maxSpeed and maxSpeed or stallSpeed)
	accel = (accel < 0.01 and 0.01 or accel > maxSpeed and maxSpeed or accel)
	altMax = ((altMax-100) < altMin and (altMin+100) or altMax)
	altMax = (altSet and (altMax+main.Position.y) or altMax)
	altMin = (altSet and (altMin+main.Position.y) or altMin)
	keys.engine.key = (keys.engine.key == "" and "e" or keys.engine.key)
	keys.spdup.byte = (keys.spdup.byte == 0 and 17 or keys.spdup.byte)
	keys.spddwn.byte = (keys.spddwn.byte == 0 and 18 or keys.spddwn.byte)
	keys.landing.key = (keys.landing.key == "" and "g" or keys.landing.key)
end

function getVars()	-- Since this plane kit is supposed to make you avoid scripting altogether, I have to go the extra mile and write a messy function to account for all those object variables
	plane = script.Parent.Plane.Value
	waitFor(plane,{"MainParts","OtherParts","AnimationParts","EDIT_THESE","Dead"})
	mainParts,info = plane.MainParts,plane.EDIT_THESE
	animationParts = plane.AnimationParts
	waitFor(mainParts,{"Main","MainSeat","LandingGear"})
	main,seat,landingGear = mainParts.Main,mainParts.MainSeat,mainParts.LandingGear
	waitFor(main,{"Move","Gyro"})
	move,gyro = main.Move,main.Gyro
	accel,canCrash,crashForce,crashSpin,crashVisual,maxBank,maxSpeed,speedVary,stallSpeed,throttleInc,altRestrict,altMin,altMax,altSet =	-- Quickest way to assign tons of variables
		A(info.Acceleration.Value),info.CanCrash.Value,A(info.CanCrash.Force.Value),info.CanCrash.SpinSpeed.Value,info.CanCrash.VisualFX.Value,
		info.MaxBank.Value,A(info.MaxSpeed.Value),A(info.SpeedDifferential.Value),A(info.StallSpeed.Value),A(info.ThrottleIncrease.Value),
		info.AltitudeRestrictions.Value,info.AltitudeRestrictions.MinAltitude.Value,info.AltitudeRestrictions.MaxAltitude.Value,info.AltitudeRestrictions.SetByOrigin.Value
	keys.engine.key = info.Hotkeys.Engine.Value:gmatch("%a")():lower()
	keys.landing.key = info.Hotkeys.Gear.Value:gmatch("%a")():lower()
	local sU,sD = info.Hotkeys.SpeedUp.Value:lower(),info.Hotkeys.SpeedDown.Value:lower()
	keys.spdup.byte = (sU == "arrowkeyup" and 17 or sU == "arrowkeydown" and 18 or sU:gmatch("%a")():byte())	-- Ternary operations use logical figures to avoid 'if' statements
	keys.spddwn.byte = (sD == "arrowkeyup" and 17 or sD == "arrowkeydown" and 18 or sD:gmatch("%a")():byte())
	fixVars()
	plane.Dead.Changed:connect(function()
		if ((plane.Dead.Value) and (not dead)) then	-- DIE!
			dead,flying,on = true,false,false
			main.Fire.Enabled,main.Smoke.Enabled = info.CanCrash.VisualFX.Value,info.CanCrash.VisualFX.Value
			move.maxForce = Vector3.new(0,0,0)
			gyro.D = 1e3
			while ((selected) and (not plane.Dead.Stop.Value)) do
				gyro.cframe = (gyro.cframe*CFrame.Angles(0,0,math.rad(crashSpin)))
				wait()
			end
		end
	end)
end

function getGear(parent)	-- Very common way to scan through every descendant of a model:
	for _,v in pairs(parent:GetChildren()) do
		if (v:IsA("BasePart")) then
			local t,r,c = Instance.new("NumberValue",v),Instance.new("NumberValue",v),Instance.new("BoolValue",v)	-- Saving original properties
			t.Name,r.Name,c.Name = "Trans","Ref","Collide"
			t.Value,r.Value,c.Value = v.Transparency,v.Reflectance,v.CanCollide
			table.insert(gearParts,v)
		end
		getGear(v)
	end
end

function getLowestPoint()	-- Plane will use LowestPoint to determine where to look to make sure the plane is either flying or on the ground
	if (#gearParts == 0) then
		lowestPoint = (main.Position.y+5+(main.Size.y/2))
		return
	end
	for _,v in pairs(gearParts) do	-- Not very efficient, but it basically does what I designed it to do:
		local _0 = (main.Position.y-(v.CFrame*CFrame.new((v.Size.x/2),0,0)).y)
		local _1 = (main.Position.y-(v.CFrame*CFrame.new(-(v.Size.x/2),0,0)).y)
		local _2 = (main.Position.y-(v.CFrame*CFrame.new(0,(v.Size.y/2),0)).y)
		local _3 = (main.Position.y-(v.CFrame*CFrame.new(0,-(v.Size.y/2),0)).y)
		local _4 = (main.Position.y-(v.CFrame*CFrame.new(0,0,(v.Size.z/2))).y)
		local _5 = (main.Position.y-(v.CFrame*CFrame.new(0,0,-(v.Size.z/2))).y)
		local n = (math.max(_0,_1,_2,_3,_4,_5)+5)
		lowestPoint = (n > lowestPoint and n or lowestPoint)
	end
end

function guiSetup()	-- Setting up the GUI buttons and such
	local cur = 0
	panel.Controls.Position = UDim2.new(0,0,0,-(panel.Controls.AbsolutePosition.y+panel.Controls.AbsoluteSize.y))
	panel.ControlsButton.MouseButton1Click:connect(function()
		cur = (cur == 0 and 1 or 0)
		if (cur == 0) then
			panel.Controls:TweenPosition(UDim2.new(0,0,0,-(panel.Controls.AbsolutePosition.y+panel.Controls.AbsoluteSize.y)),"In","Sine",0.35)
		else
			panel.Controls.Visible = true
			panel.Controls:TweenPosition(UDim2.new(0,0,1.5,0),"Out","Back",0.5)
		end
	end)
	panel.Controls.C1.Text = (keys.engine.key:upper() .. " Key")
	panel.Controls.C2.Text = (keys.spdup.byte == 17 and "UP Arrow Key" or keys.spdup.byte == 18 and "DOWN Arrow Key" or (string.char(keys.spdup.byte):upper() .. " Key"))
	panel.Controls.C3.Text = (keys.spddwn.byte == 17 and "UP Arrow Key" or keys.spddwn.byte == 18 and "DOWN Arrow Key" or (string.char(keys.spddwn.byte):upper() .. " Key"))
	panel.Controls.C4.Text = (keys.landing.key:upper() .. " Key")
end

waitFor(script.Parent,{"Plane","Deselect0","Deselect1","CurrentSelect"})
waitFor(script.Parent.Plane)
getVars()
getGear(landingGear)
getLowestPoint()
guiSetup()
if (script.Parent.Active) then
	script.Parent.Name = "RESELECT"
	while (script.Parent.Active) do wait() end
end
script.Parent.Name = "Plane"

function changeGear()
	gear = (not gear)
	for _,v in pairs(gearParts) do
		v.Transparency,v.Reflectance,v.CanCollide = (gear and v.Trans.Value or 1),(gear and v.Ref.Value or 0),(gear and v.Collide.Value or false)	-- Learning how to code like this is extremely useful
	end
end

function updateGui(taxiing,stalling)
	panel.Off.Visible = (not on)
	panel.Taxi.Visible,panel.Stall.Visible = taxiing,(not taxiing and stalling)
	if ((realSpeed > -10000) and (realSpeed < 10000)) then
		panel.Speed.Value.Text = tostring(math.floor(realSpeed+0.5))
	end
	panel.Altitude.Value.Text = tostring(math.floor(main.Position.y+0.5))
	panel.Throttle.Bar.Amount.Size = UDim2.new(throttle,0,1,0)
end

function taxi()	-- Check to see if the plane is on the ground or not
	return (currentSpeed <= stallSpeed and game.Workspace:findPartOnRay(Ray.new(main.Position,Vector3.new(0,-lowestPoint,0)),plane))	-- Make sure plane is on a surface
end

function stall()	-- Originally set as a giant ternary operation, but got WAY too complex, so I decided to break it down for my own sanity
	if ((altRestrict) and (main.Position.y > altMax)) then return true end
	local diff = ((realSpeed-stallSpeed)/200)
	diff = (diff > 0.9 and 0.9 or diff)
	local check = {	-- Table placed here so I could easily add new 'checks' at ease. If anything in this table is 'true,' then the plane will be considered to be taxiing
		(currentSpeed <= stallSpeed);
		(main.CFrame.lookVector.y > (realSpeed < stallSpeed and -1 or -diff));
	}
	for _,c in pairs(check) do
		if (not c) then return false end
	end
	return true
end

function fly(m)	-- Main function that controls all of the flying stuff. Very messy.
	flying = true
	local pos,t = main.Position,time()
	local lastStall = false
	while ((flying) and (not dead)) do
		--realSpeed = ((pos-main.Position).magnitude/(time()-t))	-- Calculate "real" speed
		realSpeed = main.Velocity.Magnitude
		pos,t = main.Position,time()
		local max = (maxSpeed+(-main.CFrame.lookVector.y*speedVary))	-- Speed variety based on the pitch of the aircraft
		desiredSpeed = (max*(on and throttle or 0))	-- Find speed based on throttle
		local change = (desiredSpeed > currentSpeed and 1 or -1)	-- Decide between accelerating or decelerating
		currentSpeed = (currentSpeed+(accel*change))	-- Calculate new speed


Prompt:
--[[
-- Чтение построек в игроке
-- Изменение и сохранение тут (точней на автомате меняется таблица объектов построек игрока)
]]

Response: build = {}


Prompt: --[[ By: Brutez. Script Fixed By Xcorrectgamermaster ]]

Response:
--
local PlayerSpawning=false; --[[ Change this to true if you want the NPC to spawn like a player, and change this to false if you want the NPC to spawn at it's current position. ]]--
local AdvancedRespawnScript=script;
repeat wait(0)until script and script.Parent and script.Parent.ClassName=="Model";
local JeffTheKiller=AdvancedRespawnScript.Parent;
local GameDerbis=game:GetService("Debris");
local JeffTheKillerHumanoid;
for _,Child in pairs(JeffTheKiller:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
JeffTheKillerHumanoid=Child;
end;
end;
local Respawndant=JeffTheKiller:Clone();
if PlayerSpawning then --[[ LOOK AT LINE: 2. ]]--
coroutine.resume(coroutine.create(function()
if JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid:FindFirstChild("Status")and not JeffTheKillerHumanoid:FindFirstChild("Status"):FindFirstChild("AvalibleSpawns")then
SpawnModel=Instance.new("Model");
SpawnModel.Parent=JeffTheKillerHumanoid.Status;
SpawnModel.Name="AvalibleSpawns";
else
SpawnModel=JeffTheKillerHumanoid:FindFirstChild("Status"):FindFirstChild("AvalibleSpawns");
end;
function FindSpawn(SearchValue)
local PartsArchivable=SearchValue:GetChildren();
for AreaSearch=1,#PartsArchivable do
if PartsArchivable[AreaSearch].className=="SpawnLocation"then
local PositionValue=Instance.new("Vector3Value",SpawnModel);
PositionValue.Value=PartsArchivable[AreaSearch].Position;
PositionValue.Name=PartsArchivable[AreaSearch].Duration;
end;
FindSpawn(PartsArchivable[AreaSearch]);
end;
end;
FindSpawn(game:GetService("Workspace"));
local SpawnChilden=SpawnModel:GetChildren();
if#SpawnChilden>0 then
local SpawnItself=SpawnChilden[math.random(1,#SpawnChilden)];
local RespawningForceField=Instance.new("ForceField");
RespawningForceField.Parent=JeffTheKiller;
RespawningForceField.Name="SpawnForceField";
GameDerbis:AddItem(RespawningForceField,SpawnItself.Name);
JeffTheKiller:MoveTo(SpawnItself.Value+Vector3.new(0,3.5,0));
else
if JeffTheKiller:FindFirstChild("SpawnForceField")then
JeffTheKiller:FindFirstChild("SpawnForceField"):Destroy();
end;
JeffTheKiller:MoveTo(Vector3.new(0,115,0));
end;
end));
end;
function Respawn()
wait(10);
Respawndant.Parent=JeffTheKiller.Parent;
Respawndant:makeJoints();
Respawndant:FindFirstChild("Head"):MakeJoints();
Respawndant:FindFirstChild("Torso"):MakeJoints();
JeffTheKiller:remove();
end;
if AdvancedRespawnScript and JeffTheKiller and JeffTheKillerHumanoid then
JeffTheKillerHumanoid.Died:Connect(Respawn);
end;


Prompt: -- A simple function to explode a specified part

Response:
function Explode(part)
	local explosion = Instance.new("Explosion", workspace)
	explosion.Position = part.Position
	explosion.BlastRadius = config.ExplosionRadius.Value
	part:Destroy()
end

script.Parent.Throw.OnServerEvent:connect(function(player, mousePosition)
	local handlePos = Vector3.new(tool.Handle.Position.X, 0, tool.Handle.Position.Z) -- remove Y from the equation, it's not needed
	local mousePos = Vector3.new(mousePosition.X, 0, mousePosition.Z) -- ditto
	local distance = (handlePos - mousePos).magnitude -- Get the distance between the handle and the mouse
	local altitude = mousePosition.Y - tool.Handle.Position.Y
	local angle = AngleOfReach(distance, altitude, config.GrenadeVelocity.Value) -- Calculate the angle

	tool.Handle.Transparency = 1
	local grenade = tool.Handle:Clone()
	grenade.Parent = workspace
	grenade.Transparency = 0
	grenade.CanCollide = true
	grenade.CFrame = tool.Handle.CFrame
	grenade.Velocity = (CFrame.new(grenade.Position, Vector3.new(mousePosition.X, grenade.Position.Y, mousePosition.Z)) * CFrame.Angles(angle, 0, 0)).lookVector * config.GrenadeVelocity.Value -- Throwing 'n stuff, it probably didn't need to be this long
	spawn(function()
		if config.ExplodeOnTouch.Value then
			grenade.Touched:connect(function(hit)
				if hit.Parent ~= tool.Parent and hit.CanCollide then -- Make sure what we're hitting is collidable
					Explode(grenade)
				end
			end)
		else
			wait(config.FuseTime.Value)
			Explode(grenade)
		end
	end)
	wait(config.Cooldown.Value)
	tool.Handle.Transparency = 0
end)


Prompt: --connection

Response:
function onSelected(mouse)
	local c = game.Players.LocalPlayer:GetChildren()
	for i = 1,#c do
		if c[i].className == "Message" or c[i].className == "Hint" then
			c[i]:Remove()
		end
	end
	if (punchload == false) then mouse.Icon = "rbxasset://textures\\GunCursor.png" end
	if (punchload == true) then mouse.Icon = "rbxasset://textures\\GunWaitCursor.png" end
	mouse.Button1Down:connect(function() FalconPUUUNCH(mouse) end)
end

bin.Selected:connect(onSelected)


Prompt:
--[=[
    Gets the default pseudo locale string.
    @return string
]=]

Response:
function PseudoLocalize.getDefaultPseudoLocaleId()
    return DEFAULT_PSEUDO_LOCALE_ID
end


Prompt: -- Created by Quenty

Response:
wait(1)

local Configuration = {
	MaxSpeed               = 30;
	Acceleration           = 5; -- Will always be a little bit less than this because ROBLOX characters will add mass. Also, friction.
	MaxRotationCorrectionAcceleration = math.pi/40;  -- I wouldn't touch this.
		-- math.pi/10 -- Correct for 18 degrees every.... second?
	PercentExtraCargo      = 0.005; -- Compared to boat's mass (weight), how much extra cargo can it support (irncludes characters) before it starts sinking.

	TurnAccelerationFactor = 150; -- E_e No idea why this is 500.
	MaxTurnSpeed           = 2.5; -- RotVelocity will probably never get to this.

	MaxShipTiltInRadians   = math.pi/8;
	TiltRatioFactor        = 0.01; -- Don't touch this. Used because the BodyAngularVelocity "can't even" when it comes to reaching desired velocity.

	AmplitudeOfWaves       = 2.5; -- How far up/down the boat moves in the waves.  (Amplitude, so if you physics, you realize it can move this magnitude away from the starting point, either up, or down).
	MaxShipYawInRadians    = math.pi/120; -- Yaws in the waves
	AddedYawOnSpeed        = math.pi/80;

	WaterLevel = 39;
}

local function WaitForChild(Parent, Name, TimeLimit)
	-- Waits for a child to appear. Not efficient, but it shoudln't have to be. It helps with debugging.
	-- Useful when ROBLOX lags out, and doesn't replicate quickly.
	-- @param TimeLimit If TimeLimit is given, then it will return after the timelimit, even if it hasn't found the child.

	assert(Parent ~= nil, "Parent is nil")
	assert(type(Name) == "string", "Name is not a string.")

	local Child     = Parent:FindFirstChild(Name)
	local StartTime = tick()
	local Warned    = false

	while not Child and Parent do
		wait(0)
		Child = Parent:FindFirstChild(Name)
		if not Warned and StartTime + (TimeLimit or 5) <= tick() then
			Warned = true
			warn("Infinite yield possible for WaitForChild(" .. Parent:GetFullName() .. ", " .. Name .. ")")
			if TimeLimit then
				return Parent:FindFirstChild(Name)
			end
		end
	end

	if not Parent then
		warn("Parent became nil.")
	end

	return Child
end

local function Modify(Instance, Values)
	-- Modifies an Instance by using a table.

	for Index, Value in next, Values do
		if type(Index) == "number" then
			Value.Parent = Instance
		else
			Instance[Index] = Value
		end
	end
	return Instance
end

local function Make(ClassType, Properties)
	-- Using a syntax hack to create a nice way to Make new items.

	return Modify(Instance.new(ClassType), Properties)
end

local Signal = {}

function Signal.new()
	local sig = {}

	local mSignaler = Instance.new('BindableEvent')

	local mArgData = nil
	local mArgDataCount = nil

	function sig:fire(...)
		mArgData = {...}
		mArgDataCount = select('#', ...)
		mSignaler:Fire()
	end

	function sig:connect(f)
		if not f then error("connect(nil)", 2) end
		return mSignaler.Event:connect(function()
			f(unpack(mArgData, 1, mArgDataCount))
		end)
	end

	function sig:wait()
		mSignaler.Event:wait()
		assert(mArgData, "Missing arg data, likely due to :TweenSize/Position corrupting threadrefs.")
		return unpack(mArgData, 1, mArgDataCount)
	end

	return sig
end

local function WeldTogether(Part0, Part1, JointType, WeldParent)
	--- Weld's 2 parts together
	-- @param Part0 The first part
	-- @param Part1 The second part (Dependent part most of the time).
	-- @param [JointType] The type of joint. Defaults to weld.
	-- @param [WeldParent] Parent of the weld, Defaults to Part0 (so GC is better).
	-- @return The weld created.

	JointType = JointType or "Weld"

	local NewWeld = Make(JointType, {
		Part0  = Part0;
		Part1  = Part1;
		C0     = CFrame.new();--Part0.CFrame:inverse();
		C1     = Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse();
		Parent = WeldParent or Part0;
	})

	return NewWeld
end

local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor)
	-- @param Parts The Parts to weld. Should be anchored to prevent really horrible results.
	-- @param MainPart The part to weld the model to (can be in the model).
	-- @param [JointType] The type of joint. Defaults to weld.
	-- @parm DoNotUnanchor Boolean, if true, will not unachor the model after cmopletion.

	for _, Part in pairs(Parts) do
		WeldTogether(MainPart, Part, JointType, MainPart)
	end

	if not DoNotUnanchor then
		for _, Part in pairs(Parts) do
			Part.Anchored = false
		end
		MainPart.Anchored = false
	end
end

local function CallOnChildren(Instance, FunctionToCall)
	-- Calls a function on each of the children of a certain object, using recursion.

	FunctionToCall(Instance)

	for _, Child in next, Instance:GetChildren() do
		CallOnChildren(Child, FunctionToCall)
	end
end

local function GetBricks(StartInstance)
	local List = {}

	-- if StartInstance:IsA("BasePart") then
	-- 	List[#List+1] = StartInstance
	-- end

	CallOnChildren(StartInstance, function(Item)
		if Item:IsA("BasePart") then
			List[#List+1] = Item;
		end
	end)

	return List;
end

local function GetBricksWithIgnoreFunction(StartInstance, DoIgnore)
	--- Get's the bricks in a model, but will not get a brick that is "NoInclude"

	local List = {}

	CallOnChildren(StartInstance, function(Item)
		if Item:IsA("BasePart") and not DoIgnore(Item) then
			List[#List+1] = Item
		end
	end)

	return List
end

local function GetCharacter(Descendant)
	-- Returns the Player and Charater that a descendent is part of, if it is part of one.
	-- @param Descendant A child of the potential character.

	local Charater = Descendant
	local Player   = Players:GetPlayerFromCharacter(Charater)

	while not Player do
		if Charater.Parent then
			Charater = Charater.Parent
			Player   = Players:GetPlayerFromCharacter(Charater)
		else
			return nil
		end
	end

	return Charater, Player
end

local MakeMaid do
	local index = {
		GiveTask = function(self,task)
			local n = #self.Tasks+1
			self.Tasks[n] = task
			return n
		end;
		DoCleaning = function(self)
			local tasks = self.Tasks
			for name,task in pairs(tasks) do
				if type(task) == 'function' then
					task()
				else
					task:disconnect()
				end
				tasks[name] = nil
			end
			-- self.Tasks = {}
		end;
	};
	local mt = {
		__index = function(self,k)
			if index[k] then
				return index[k]
			else
				return self.Tasks[k]
			end
		end;
		__newindex = function(self,k,v)
			local tasks = self.Tasks
			if v == nil then
				-- disconnect if the task is an event
				if type(tasks[k]) ~= 'function' then
					tasks[k]:disconnect()
				end
			elseif tasks[k] then
				-- clear previous task
				self[k] = nil
			end
			tasks[k] = v
		end;
	}

	function MakeMaid()
		return setmetatable({Tasks={},Instances={}},mt)
	end
end

local function CheckPlayer(Player)
	--- Makes sure a player has all necessary components.
	-- @return Boolean If the player has all the right components

	return Player and Player:IsA("Player")
end

local function CheckCharacter(Player)
	-- Makes sure a character has all the right "parts"

	if CheckPlayer(Player) then
		local Character = Player.Character;

		if Character then

			return Character.Parent
				and Character:FindFirstChild("Humanoid")
				and Character:FindFirstChild("HumanoidRootPart")
				and Character:FindFirstChild("Torso")
				and Character:FindFirstChild("Head")
				and Character.Humanoid:IsA("Humanoid")
				and Character.Head:IsA("BasePart")
				and Character.Torso:IsA("BasePart")
				and true
		end
	else
		print("[CheckCharacter] - Character Check failed!")
	end

	return nil
end

local function GetCenterOfMass(Parts)
	--- Return's the world vector center of mass.
	-- Lots of help from Hippalectryon :D

	local TotalMass = 0
	local SumOfMasses = Vector3.new(0, 0, 0)

	for _, Part in pairs(Parts) do
		-- Part.BrickColor = BrickColor.new("Bright yellow")
		TotalMass = TotalMass + Part:GetMass()
		SumOfMasses = SumOfMasses + Part:GetMass() * Part.Position
	end

	-- print("Sum of masses: " .. tostring(SumOfMasses))
	-- print("Total mass:    " .. tostring(TotalMass))

	return SumOfMasses/TotalMass, TotalMass
end


Prompt:
--[[

	timer = Timer.new(interval: number [, janitor: Janitor])
	connection = Timer.Simple(interval: number, callback: () -> void [, updateSignal: Signal = Heartbeat, timeFunc: () -> number = time])

	timer.Tick: Signal
	timer.Interval: number
	timer.UpdateSignal: Signal
	timer.TimeFunction: () -> number
	timer.AllowDrift: boolean

	timer:Start()
	timer:StartNow()
	timer:Stop()
	timer:Destroy()

	------------------------------------

	local timer = Timer.new(2)
	timer.Tick:Connect(function()
		print("Tock")
	end)
	timer:Start()

	Timer.Simple(2, function()
		print("Tock")
	end)

--]]

Response:
type CallbackFunc = () -> nil
type TimeFunc = () -> number

local Signal = require(script.Parent.Signal)

local RunService = game:GetService("RunService")

local Timer = {}
Timer.__index = Timer

function Timer.new(interval: number, janitor)
	assert(type(interval) == "number", "Argument #1 to Timer.new must be a number; got " .. type(interval))
	assert(interval >= 0, "Argument #1 to Timer.new must be greater or equal to 0; got " .. tostring(interval))
	local self = setmetatable({}, Timer)
	self._runHandle = nil
	self.Interval = interval
	self.UpdateSignal = RunService.Heartbeat
	self.TimeFunction = time
	self.AllowDrift = true
	self.Tick = Signal.new()
	if janitor then
		janitor:Add(self)
	end
	return self
end

function Timer.Simple(interval: number, callback: CallbackFunc, startNow: boolean?, updateSignal: RBXScriptSignal?, timeFunc: TimeFunc?)
	local update = updateSignal or RunService.Heartbeat
	local t = timeFunc or time
	local nextTick = t() + interval
	if startNow then
		task.defer(callback)
	end
	return update:Connect(function()
		local now = t()
		if now >= nextTick then
			nextTick = now + interval
			task.defer(callback)
		end
	end)
end

function Timer.Is(obj: any): boolean
	return type(obj) == "table" and getmetatable(obj) == Timer
end

function Timer:_startTimer()
	local t = self.TimeFunction
	local nextTick = t() + self.Interval
	self._runHandle = self.UpdateSignal:Connect(function()
		local now = t()
		if now >= nextTick then
			nextTick = now + self.Interval
			self.Tick:Fire()
		end
	end)
end

function Timer:_startTimerNoDrift()
	assert(self.Interval > 0, "Interval must be greater than 0 when AllowDrift is set to false")
	local t = self.TimeFunction
	local n = 1
	local start = t()
	local nextTick = start + self.Interval
	self._runHandle = self.UpdateSignal:Connect(function()
		local now = t()
		while now >= nextTick do
			n += 1
			nextTick = start + (self.Interval * n)
			self.Tick:Fire()
		end
	end)
end

function Timer:Start()
	if self._runHandle then return end
	if self.AllowDrift then
		self:_startTimer()
	else
		self:_startTimerNoDrift()
	end
end

function Timer:StartNow()
	if self._runHandle then return end
	self.Tick:Fire()
	self:Start()
end

function Timer:Stop()
	if not self._runHandle then return end
	self._runHandle:Disconnect()
	self._runHandle = nil
end

function Timer:Destroy()
	self.Tick:Destroy()
	self:Stop()
end

return Timer


Prompt:
--[[
	This loads HD Admin into your game.

	Require the 'HD Admin MainModule' by the HD Admin group for automatic updates.

	You can view the HD Admin Main Module here:
	https://www.roblox.com/library/3239236979/HD

--]]

Response:
local loaderFolder = script.Parent.Parent
local mainModule = require(3239236979)
mainModule:Initialize(loaderFolder)
loaderFolder:Destroy()


Prompt: --[Funkcje]

Response:
function onClicked()
	if legansio == true then
		sl7.Material = "Plastic"
		sp7.Material = "Plastic"
		sl7.SurfaceLight.Enabled = false
		sp7.SurfaceLight.Enabled = false
		wait(2)
		sp7.Transparency = 1
		sl7.Transparency = 1
		p7.Transparency = 1
		l7.Transparency = 1
		sp6.Transparency = 0
		sl6.Transparency = 0
		l6.Transparency = 0
		p6.Transparency = 0
		wait(0.1)
		p6.Transparency = 1
		l6.Transparency = 1
		sl6.Transparency = 1
		sp6.Transparency = 1
		sp5.Transparency = 0
		sl5.Transparency = 0
		l5.Transparency = 0
		p5.Transparency = 0
		wait(0.1)
		p5.Transparency = 1
		l5.Transparency = 1
		sp5.Transparency = 1
		sl5.Transparency = 1
		sp4.Transparency = 0
		sl4.Transparency = 0
		l4.Transparency = 0
		p4.Transparency = 0
		wait(0.1)
		p4.Transparency = 1
		l4.Transparency = 1
		sp4.Transparency = 1
		sl4.Transparency = 1
		sp3.Transparency = 0
		sl3.Transparency = 0
		l3.Transparency = 0
		p3.Transparency = 0
		wait(0.1)
		p3.Transparency = 1
		l3.Transparency = 1
		sp3.Transparency = 1
		sl3.Transparency = 1
		sp2.Transparency = 0
		sl2.Transparency = 0
		l2.Transparency = 0
		p2.Transparency = 0
		wait(0.1)
		p2.Transparency = 1
		l2.Transparency = 1
		sp2.Transparency = 1
		sl2.Transparency = 1
		sp1.Transparency = 0
		sl1.Transparency = 0
		l1.Transparency = 0
		p1.Transparency = 0
		wait(1)
		q1.Transparency = 1
		p1.Transparency = 1
		l1.Transparency = 1
		sp1.Transparency = 1
		sl1.Transparency = 1
		wait(0.1)
		s1.Transparency = 0
		wait(1)
		g14.Transparency = 0
		s1.Transparency = 1
		pala7.Transparency = 1
		wait(0.1)
		g14.Transparency = 1
		g13.Transparency = 0
		wait(0.1)
		g13.Transparency = 1
		g12.Transparency = 0
		wait(0.1)
		g12.Transparency = 1
		g11.Transparency = 0
		wait(0.1)
		g11.Transparency = 1
		pala6.Transparency = 1
		g10.Transparency = 0
		wait(0.1)
		g10.Transparency = 1
		g9.Transparency = 0
		wait(0.1)
		g9.Transparency = 1
		g8.Transparency = 0
		wait(0.1)
		g8.Transparency = 1
		pala5.Transparency = 1
		g7.Transparency = 0
		wait(0.1)
		g7.Transparency = 1
		g6.Transparency = 0
		wait(0.1)
		g6.Transparency = 1
		g5.Transparency = 0
		pala4.Transparency = 1
		wait(0.1)
		g5.Transparency = 1
		g4.Transparency = 0
		wait(0.1)
		g4.Transparency = 1
		g3.Transparency = 0
		pala3.Transparency = 1
		wait(0.1)
		g3.Transparency = 1
		g2.Transparency = 0
		wait(0.1)
		pala2.Transparency = 1
		g2.Transparency = 1
		g1.Transparency = 0
	end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)


Prompt: --Audio

Response:
local soundBank =  game.ReplicatedStorage.Sounds.NPC.Gobbler:GetChildren()
critter.Health.Changed:connect(function()
    local hitSound = soundBank[math.random(1,#soundBank)]:Clone()
    hitSound.Parent = critter.PrimaryPart
    hitSound.PlayOnRemove = true
    wait()
    hitSound:Destroy()
end)

while true do
    bp.Parent = critter.PrimaryPart
    local goal
    repeat
    local ray = Ray.new(Vector3.new(origin.p.x+math.random(-tether,tether), critter.PrimaryPart.Position.Y+100, origin.p.z+math.random(-tether,tether)),Vector3.new(0,-130,0))
    local part,pos,norm,mat = workspace:FindPartOnRay(ray,critter)
    if part == workspace.Terrain and mat ~= Enum.Material.Water then
        goal = pos+Vector3.new(0,2.25,0)
    end
    wait()
    until goal
    --Set new goal for critter to MoveTo :)
    walk:Play()
    local pos = critter.PrimaryPart.Position
    local cf = CFrame.new(Vector3.new(pos.X, 0, pos.Z), Vector3.new(goal.X, 0, goal.Z))
    bg.CFrame = cf
    bp.Position = (cf*CFrame.new(0,0,-100)).p

    local start = tick()
    repeat wait(.5)
    local ray = Ray.new(critter.PrimaryPart.Position, Vector3.new(0,-140,0))

    until (critter.PrimaryPart.Position-goal).magnitude < 10 or tick()-start >10
    walk:Stop()
    bp.Parent = nil
    wait(math.random(3,8))
end


Prompt: -- Class

Response:
local ViewportWindow = {}
ViewportWindow.__index = ViewportWindow


Prompt: -- Functions

Response:
function TeamManager:CreateTeams()
	local newTeam = Instance.new("Team", game.Teams)
	newTeam.TeamColor = BrickColor.new("Bright red")
	TeamPlayers[newTeam] = {}
	TeamScores[newTeam] = 0

	newTeam = Instance.new("Team", game.Teams)
	newTeam.TeamColor = BrickColor.new("Bright blue")
	TeamPlayers[newTeam] = {}
	TeamScores[newTeam] = 0
end

function TeamManager:CreateFFATeam()
	local newTeamColor = BrickColor.Random()
	while GetTeamFromColor(newTeamColor) do
		newTeamColor = BrickColor.Random()
	end

	local newTeam = Instance.new("Team", game.Teams)
	newTeam.TeamColor = newTeamColor
	TeamPlayers[newTeam] = {}
	TeamScores[newTeam] = 0
	return newTeam
end

function TeamManager:AssignPlayerToTeam(player)
	local smallestTeam
	local lowestCount = math.huge
	for team, playerList in pairs(TeamPlayers) do
		if #playerList < lowestCount then
			smallestTeam = team
			lowestCount = #playerList
		end
	end

	if not Configurations.TEAMS and (not smallestTeam or #TeamPlayers[smallestTeam] > 0) then
		smallestTeam = TeamManager:CreateFFATeam()
	end

	table.insert(TeamPlayers[smallestTeam], player)
	player.Neutral = false
	player.TeamColor = smallestTeam.TeamColor
end

function TeamManager:RemovePlayer(player)
	local team = GetTeamFromColor(player.TeamColor)
	local teamTable = TeamPlayers[team]
	for i = 1, #teamTable do
		if teamTable[i] == player then
			table.remove(teamTable, i)
			if not Configurations.TEAMS then
				team:Destroy()
			end
			return
		end
	end
end

function TeamManager:ClearTeamScores()
	for _, team in pairs(Teams:GetTeams()) do
		TeamScores[team] = 0
		if Configurations.TEAMS then
			DisplayManager:UpdateScore(team, 0)
		end
	end
end

function TeamManager:AddTeamScore(teamColor, score)
	local team = GetTeamFromColor(teamColor)
	TeamScores[team] = TeamScores[team] + score
	if Configurations.TEAMS then
		DisplayManager:UpdateScore(team, TeamScores[team])
	end
end

function TeamManager:HasTeamWon()
	for _, team in pairs(Teams:GetTeams()) do
		if TeamScores[team] >= Configurations.POINTS_TO_WIN then
			return team
		end
	end
	return false
end

function TeamManager:GetWinningTeam()
	local highestScore = 0
	local winningTeam = nil
	for _, team in pairs(Teams:GetTeams()) do
		if TeamScores[team] > highestScore then
			highestScore = TeamScores[team]
			winningTeam = team
		end
	end
	return winningTeam
end

function TeamManager:AreTeamsTied()
	local teams = Teams:GetTeams()
	local highestScore = 0
	local tied = false
	for _, team in pairs(teams) do
		if TeamScores[team] == highestScore then
			tied = true
		elseif TeamScores[team] > highestScore then
			tied = false
			highestScore = TeamScores[team]
		end
	end
	return tied
end

function TeamManager:ShuffleTeams()
	for _, team in pairs(Teams:GetTeams()) do
		TeamPlayers[team] = {}
	end
	local players = Players:GetPlayers()
	while #players > 0 do
		local rIndex = math.random(1, #players)
		local player = table.remove(players, rIndex)
		TeamManager:AssignPlayerToTeam(player)
	end
end


Prompt:
--[[
	Provides an API to use when referencing a Player's character
	to make sure it is "Fully loaded", which is defined as:
		1) Character is a descendant of workspace
		2) Character has a PrimaryPart set
		3) Character contains a child which is a Humanoid
		4) The Humanoid's RootPart property is not nil

	This differs from Player.CharacterAdded and Player.CharacterAppearanceLoaded which fire
	before a character is parented to workspace and does not guarantee these other conditions.

	This loaded event won't be necessary once the Player.CharacterAdded is moved to the end of the event
	call stack, per https://devforum.roblox.com/t/avatar-loading-event-ordering-improvements/269607

	This wrapper provides a died event when the first of the following happens:

	1) Humanoid's .Died event fires
	2) Character is removed

	We need this because there are some cases where a character can be removed without the humanoid dying,
	such as if :LoadCharacter() is called before a character dies. Cleanup code often needs to run when a
	character's "lifespan" is over, whether it be because the humanoid died or because the character is removed.
	To avoid having to connect to both events in multiple places, this wrapper moves both events into one.
--]]

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

local Signal = require(ReplicatedStorage.Source.Signal)
local Connections = require(ReplicatedStorage.Source.Connections)
local waitForChildOfClassAsync = require(ReplicatedStorage.Source.Utility.waitForChildOfClassAsync)

local function isPrimaryPartSet(character: Model)
	return if character.PrimaryPart then true else false
end

local function isHumanoidRootPartSet(humanoid: Humanoid)
	return if humanoid.RootPart then true else false
end

local function getHumanoid(character: Model)
	return character:FindFirstChildOfClass("Humanoid")
end

local function isHumanoidAlive(character: Model)
	local humanoidMaybe = getHumanoid(character)
	if not humanoidMaybe then
		return false
	end

	local humanoid = humanoidMaybe :: Humanoid
	return isHumanoidRootPartSet(humanoid) and humanoid.Health > 0
end

local CharacterLoadedWrapper = {}
CharacterLoadedWrapper.__index = CharacterLoadedWrapper

export type ClassType = typeof(setmetatable(
	{} :: {
		loaded: Signal.ClassType,
		died: Signal.ClassType,
		_player: Player,
		_destroyed: boolean,
		_connections: Connections.ClassType,
	},
	CharacterLoadedWrapper
))

function CharacterLoadedWrapper.new(player: Player): ClassType
	local self = {
		loaded = Signal.new(),
		died = Signal.new(),
		_player = player,
		_destroyed = false,
		_connections = Connections.new(),
	}
	setmetatable(self, CharacterLoadedWrapper)

	self:_listenForCharacterAdded()

	return self
end

function CharacterLoadedWrapper.isLoaded(self: ClassType, optionalCharacter: Model?)
	-- Character can be passed in to check if a specific character model is
	-- the currently loaded character model. Useful if you are maintaining a reference
	-- to a specific character model, you want to verify that :isLoaded() is true, but
	-- you also want to make sure your current character reference isn't out of date.
	local characterMaybe = optionalCharacter or self._player.Character
	if not characterMaybe then
		return false
	end

	local character = characterMaybe :: Model

	return isPrimaryPartSet(character) and isHumanoidAlive(character) and character:IsDescendantOf(Workspace)
end

function CharacterLoadedWrapper._listenForCharacterAdded(self: ClassType)
	task.spawn(function()
		local character = self._player.Character

		-- Avoids firing .loaded event when the character is already loaded
		if character then
			if self:isLoaded() then
				self:_listenForDeath(character)
			else
				self:_waitForLoadedAsync(character)
			end
		end

		local characterAddedConnection = self._player.CharacterAdded:Connect(function(newCharacter: Model)
			self:_waitForLoadedAsync(newCharacter)
		end)

		self._connections:add(characterAddedConnection)
	end)
end


Prompt: -- Set anchor at offset from absolute position

Response:
function Element:setAnchor(offsetX, offsetY)
	if(offsetX > self:getSize().x or offsetY > self:getSize().y or offsetX < 0 or offsetY < 0) then
		error("Attempt to set anchor beyond element's bounds")
	else
		self.anchor = Vector2.new(offsetX, offsetY)
	end
end

function Element:isDisplayed()
	return self:getRbxInstance().Visible
end

function Element:isSelected()
	return self:getRbxInstance().Selected
end

function Element:getRbxInstance()
	return self:waitForRbxInstance(self.path.waitDelay, self.path.waitTimeout)
end

function Element:waitForRbxInstance(timeout, delay)
	if self.rbxInstance == nil and self.path ~= nil then
		self.path:setWait(timeout, delay)
		self.rbxInstance = self.path:waitForFirstInstance()
	end

	if self.rbxInstance and not self.anchor then
		if pcall(function() local size = self.rbxInstance.AbsoluteSize end) then
			self.anchor = self.rbxInstance.AbsoluteSize/2
		else
			self.anchor = nil
		end
	end

	return self.rbxInstance
end

function Element:_override(class)
	for k, v in pairs(class) do
		if not k:find("^_") then
			self[k] = v
		end
	end
end

function Element:centralizeInstance()
	self:_centralizeInScrollingFrame(self:getRbxInstance())
end

function Element:centralize()
	local instance = self:getRbxInstance()
	if instance then
		self:centralizeInstance()
	else
		self:centralizeWithInfiniteScrolling()
	end
end

function Element:_scrollingFrames(instance)
	if instance == nil or instance == game then return 0 end
	local num = self:_scrollingFrames(instance.Parent)
	if instance.ClassName == "ScrollingFrame" then num = num + 1 end
	return num
end

function Element:_centralizeInScrollingFrame(child, parent)
	if child == game then return end
	parent = parent or child.Parent
	if parent == game then return end

	if parent.ClassName == "ScrollingFrame" then
		self:_centralizeInScrollingFrame(parent, parent.Parent)
		-- this is computational error tolerate.
		local threshold = 2

		--first scroll down to make child appears neas screen,
		--so that we can access child.AbsolutPosition property
		local isChildInScreen = false
		while not isChildInScreen do

			local prevChildPosition = child.AbsolutePosition
			local prevCanvasPosition = parent.CanvasPosition
			-- when scroll too much at one time, the element may move out side of screen immediately
			-- its AbsoluteSize will not update. limit to 300
			local scrollDistance = Vector2.new(math.min(300, parent.AbsoluteSize.X), math.min(300, parent.AbsoluteSize.Y))
			parent.CanvasPosition  = parent.CanvasPosition + scrollDistance
			wait()
			local deltaCanvas = (parent.CanvasPosition - prevCanvasPosition)
			local isBottom = deltaCanvas.Magnitude <= threshold
			local deltaChild = child.AbsolutePosition - prevChildPosition
			isChildInScreen = isBottom or deltaChild.Magnitude > threshold
		end
		--second scroll to centerize the child, at most twice.
		for _ = 1, 2 do
			local frameCenter = parent.AbsolutePosition + parent.AbsoluteSize/2
			local childCenter = child.AbsolutePosition + child.AbsoluteSize/2
			local delta = childCenter - frameCenter
			if delta.Magnitude <= threshold then break end
			parent.CanvasPosition  = parent.CanvasPosition + delta
			wait()
		end
	else
		self:_centralizeInScrollingFrame(child, parent.Parent)
	end
end

function Element:_scrollToFindInstance(scrollingFrame, absPath)


Prompt: -- Local Functions

Response:
local function StartIntermission()

	-- Find flag to circle. Default to circle center of map
	local possiblePoints = {}
	table.insert(possiblePoints, Vector3.new(0,50,0))

	for _, child in ipairs(game.Workspace:GetChildren()) do
		if child.Name == "FlagStand" then
			table.insert(possiblePoints, child.FlagStand.Position)
		end
	end

	local focalPoint = possiblePoints[math.random(#possiblePoints)]
	Camera.CameraType = Enum.CameraType.Scriptable
	Camera.Focus = CFrame.new(focalPoint)

	local angle = 0
	game.Lighting.Blur.Enabled = true
	RunService:BindToRenderStep('IntermissionRotate', Enum.RenderPriority.Camera.Value, function()
		local cameraPosition = focalPoint + Vector3.new(50 * math.cos(angle), 20, 50 * math.sin(angle))
		Camera.CoordinateFrame = CFrame.new(cameraPosition, focalPoint)
		angle = angle + math.rad(.25)
	end)
end

local function StopIntermission()
	game.Lighting.Blur.Enabled = false
	RunService:UnbindFromRenderStep('IntermissionRotate')
	Camera.CameraType = Enum.CameraType.Custom
end

local function OnDisplayIntermission(display)
	if display and not InIntermission then
		InIntermission = true
		StartIntermission()
	end
	if not display and InIntermission then
		InIntermission = false
		StopIntermission()
	end
end


Prompt: --Var

Response: local farawayCFrame: CFrame = CFrame.new(0, 10e8, 0)


Prompt: -- If you want to know how to retexture a hat, read this:  http://www.roblox.com/Forum/ShowPost.aspx?PostID=10502388

Response:
debounce = true

function onTouched(hit)
	if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true) then
		debounce = false
		h = Instance.new("Hat")
		p = Instance.new("Part")
		h.Name = "Hat"   -- It doesn't make a difference, but if you want to make your place in Explorer neater, change this to the name of your hat.
		p.Parent = h
		p.Position = hit.Parent:findFirstChild("Head").Position
		p.Name = "Handle"
		p.formFactor = 0
		p.Size = Vector3.new(-0,-0,-1)
		p.BottomSurface = 0
		p.TopSurface = 0
		p.Locked = true
		script.Parent.Mesh:clone().Parent = p
		h.Parent = hit.Parent
		h.AttachmentPos = Vector3.new(0, -0.45, -0.01) -- Change these to change the positiones of your hat, as I said earlier.
		wait(5)		debounce = true
	end
end

script.Parent.Touched:connect(onTouched)


Prompt: --[[ The rest isn't as customizable" ]]

Response:
--

debrisS, playerS, datastoreS, gamepassS, marketS =
game:GetService("Debris"),
game:GetService("Players"),
game:GetService("DataStoreService"),
game:GetService("GamePassService"),
game:GetService("MarketplaceService")

function passedPlayer(p, isLeaving)
	print(p.Name.." has passed")
	local function sendMessage(txt)
		if gameStats["DoMessages?"] then
			local message = Instance.new("Message", p.PlayerGui)
			message.Text = txt
			debrisS:AddItem(message, 2)
		end
	end
	local save, load =
	function()
		local cDatastore, statStorage =
		datastoreS:GetDataStore(p.Name.."Stats"),
		p:WaitForChild("PlayerData"):GetChildren()
		for i =  1, #statStorage do
			cDatastore:SetAsync(statStorage[i].Name, statStorage[i].Value)
		end
		sendMessage("Your stats have been saved.")
	end,
	function()
		local cDatastore, stats =
		datastoreS:GetDataStore(p.Name.."Stats"),
		p:FindFirstChild("PlayerData"):GetChildren()
		for i = 1, #stats do
			stats[i].Value = cDatastore:GetAsync(stats[i].Name)
		end
		sendMessage("Your stats have been loaded.")
	end
	local chatted = function(c)
		c = c:lower()
		for i, v in pairs(gameStats["DoChat?"]["Keywords"]) do
			if (c == v) then
				save()
			end
		end
	end
	if isLeaving then
		save()
	else
		load()
		if gameStats["DoChat?"]["DoIt?"] then
			p["Chatted"]:connect(chatted)
		end
	end
end

function passTest(p, isLeaving)
	print("Test starting")
	if gameStats["IsAnObby?"] then
		local cAdded = function(c)
			p:LoadCharacter(true)
		end
		p["CharacterAdded"]:connect(cAdded)
	end
	if gameStats.saveType["Normal?"] then
		passedPlayer(p, isLeaving)
	else
		if gameStats.saveType["SavingList?"]["DoIt?"] then
			for i, v in pairs(gameStats.saveType["SavingList?"].theList) do
				if (p.Name == v) then
					passedPlayer(p, isLeaving)
				end
			end
		elseif gameStats.saveType["BestFriends?"] then
			if p:IsBestFriendsWith(game.CreatorId) then
				passedPlayer(p, isLeaving)
			end
		elseif gameStats.saveType["Friends?"] then
			if p:IsFriendsWith(game.CreatorId) then
				passedPlayer(p, isLeaving)
			end
		elseif gameStats.saveType["OwnerOnly?"] then
			if (p.userId == game.CreatorId) then
				passedPlayer(p, isLeaving)
			end
		elseif gameStats.saveType["Gamepass?"]["DoIt?"] then
			if p:PlayerHasPass(p, gameStats.saveType["Gamepass?"]["GamepassId"]) then
				passedPlayer(p, isLeaving)
			end
		elseif gameStats.saveType["Asset/Item?"]["DoIt?"] then
			if p:PlayerOwnsAsset(p, gameStats.saveType["Asset/Item?"]["AssetId"]) then
				passedPlayer(p, isLeaving)
			end
		end
	end
end

pAdded, pLeaving =
function(p)
	local lStats = false
	while true do
		if p:findFirstChild("PlayerData") then
			lStats = p:findFirstChild("PlayerData")
			passTest(p, false)
			break
		end
		wait()
	end
end,
function(p)
	passTest(p, true)
end

playerS["PlayerAdded"]:connect(pAdded)
playerS["PlayerRemoving"]:connect(pLeaving)


Prompt:
--[[
	Create a new binding object with the given starting value. This
	function will be exposed to users of Roact.
]]

Response:
function Binding.create(initialValue)
	local binding = {
		[Type] = Type.Binding,

		[InternalData] = {
			value = initialValue,
			changeSignal = createSignal(),
			subscriberCount = 0,

			valueTransform = identity,
			upstreamBinding = nil,
			upstreamDisconnect = nil,
		},
	}

	setmetatable(binding, bindingPrototype)

	local setter = function(newValue)
		Binding.update(binding, newValue)
	end

	return binding, setter
end

return Binding


Prompt: -- Used by event system to capture/rethrow the first error.

Response:
local hasRethrowError = false
local rethrowError = nil
local reporter = {
	onError = function(err)
		hasError = true
		caughtError = err
	end,
}
local exports = {}


Prompt:
--[[
	Executes all enqueued tasks, and clears out the task lists ready for new
	tasks.
]]

Response:
function Scheduler.runTasks()
	-- if no tasks were enqueued, exit early
	if not willUpdate then
		return
	end

	-- execute property changes
	for instance, propertyTable in pairs(propertyChanges) do
		for property, value in pairs(propertyTable) do
			if value == None then
				value = nil
			end
			instance[property] = value
		end
	end

	-- run deferred callbacks
	for callback in pairs(callbacks) do
		callback()
	end

	willUpdate = false
	table.clear(propertyChanges)
	table.clear(callbacks)
end

RunService:BindToRenderStep(
	"__FusionUIScheduler",
	Enum.RenderPriority.Last.Value,
	Scheduler.runTasks
)

return Scheduler


Prompt:
--[[                                           <<DO NOT DELETE THIS MODULE>>
   ___      _______                _
  / _ |____/ ___/ /  ___ ____ ___ (_)__
 / __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_|   \___/_//_/\_,_/___/___/_/___/	Build 6.42S
				SecondLogic @ Inspare

>>Manual

Basically...everything you can and would ever want to touch is in the tuning module. EVERYTHING

Torque Curve Tune Visualizer:
https://www.desmos.com/calculator/2uo3hqwdhf

Basic Tips:
--Installation
	>Everything is built-in (assembly, welding, suspension, gyros), so all you have to worry about is placing the wheels and the seat.
	>Body parts go in the "Body" section.
	>Wheel parts such as 3D rims and brake disks go in the "Parts" section of the wheel.
	>Suspension-Anchored parts such as suspension wishbones and linkages go in the "SuspensionFixed" section.
	>Axle-Anchored parts such as calipers go in the "WheelFixed" section.
	>You can add or remove wheels. To add a wheel, simply copy one of the wheels and make sure it's named one of the following: "F","FL","FR","R","RL","RR".
	>Wheels need to be aligned with the axes of the seat. Don't rotate the seat relative to the wheels as it may cause welding problems.
	>All wheel offsets are applied in the tuning module. Do NOT manually add offset to the wheels. Steering axis is centered on the wheel part by default.
	>Seat offset can be adjusted in the "MiscWeld" module under "Initialize".
	>Use the "Misc" section for scripted/moving parts and apply welding using the "MiscWeld" module under "Initialize".

--Tuning
	>Reduce weight(density) if setup is lacking torque. Increase density if setup has too much torque.
	>Add downforce to the wheels manually if setup is lacking grip or use a downforce plugin.
	>Dialing in ratios used in real cars is an easy way to have a realisticly tuned transmission.
	>Modifying the "Drive" script may affect the integrity of the system.
	>Custom scripts should be put in the "Plugins" folder. Using plugins made by other users is encouraged.
	>When writing custom plugins, you can reference the values within the "Values" folder inside the A-Chassis Interface.
	>It is a good practice to make plugins compatible with any setup and providing a usage manual if a plugin is released.
	>Yes, you can remove/change the default plugins that come with the kit. The drive system will still work perfectly.

--Updates
	>To update, simply just replace the entire "A-Chassis Tune" module of an existing car with a newer version of the module.
	>You may want to copy the tune values and plugins from the old module, but dont simply overwrite the tune module as new values may be added.

>>Changelog
	[5/20/17 : Build 6.42S] - ABS and PGS Standardization

		[Added ABS]
		-Modulates brakes when locking
		-Added threshold value for slip allowance
		-Added control toggles for ABS
		-Added ABS indicator and control mapping to stock UI

		[Split Density Tuning for PGS and Legacy]
		-Added standardized weight scaling values to tune
		-Default weight tuning set to 1 cubic stud : 50 lbs for PGS
		-Default weight tuning set to 1 cubic stud : 10 lbs for Legacy
		-Split front and rear density to PGS and Legacy
		-Split brake force tuning to PGS and Legacy

		[Added Tune Values]
		-TCSEnabled: Sets whether or not the car will have TCS
		-ABSEnabled: Sets whether or not the car will have ABS
		-LoadDelay: Sets a delay time before initializing car

		[Bug Fix: Axle Size Initialization]
		-Car applies proper axle size
		-Added AxleDensity value which sets axle density
		-Fixed miscelaneous wheel part welding

		[Added Changable Stock Gauge Units]
		-Added units system for stock gauges
		-Added default units: MPH [1 stud : 10 in], KP/H [1 stud : 10 in], SPS
		-Custom units can be added or removed
		-Click on speed to change between units
		-Moved Controls button to middle for better visibility

		[Code Documentation]
		-Extensive documentation and commenting within scripts for better readability
		-Improved warning message for oversized mass condition

	[5/4/17 : Build 6.41S] - Standardized Weight

		[Added automatic weight system]
		-Added tune values for car weight, center of gravity, and wheel density
		-Weight standard: 100 lbs = 1 cubic stud mass
		-Applies weight at initialization

		[Scaled Down Power Delivery]
		-Horsepower output now at 1/10 because of lighter weight standard
		-Added FDMult value in transmission for gear ratio scaling without having to change Final Drive (useful for low HP tunes)

		[Optimized value for Anchor Offset]
		-Changed "SusOffset" to "Anchor Offset"
		-New anchor offset is now based off of wishbone length and wishbone angle.
		-Anchor offset now labelled for forward, lateral, and vertical offsets.

		[Split some tune values to F/R]
		-Suspension values for front and rear are now independently tunable.
		-Front and rear brakes can be tuned independently.

		[Tune Module Housekeeping]
		-Rearranged and documented several of the values within the tune module.
		-Removed GyroP and GyroMaxTorque for simplicity. Dampening values are still present.
		-Changed some decimal values to percent values

	[1/2/17 : Build 6.40S] - Suspension
		"S" Build number identifies suspension build

		[Added suspension system for PGS Physics Solver]
		-Suspension uses ROBLOX constraints and is automatically generated with the chassis
		-Added tune values for suspension
		-Temporarily removed caster tuning

		[Steering Fix]
		-Added tune value 'ReturnSpeed' which determines how fast wheels return to default orientation

		[New Torque Curve Equation]
		-New equation gives more control over the shape of the torque curve
		-Engine values have been replaced with the new equation's variables
		-Added link to desmos graph for the torque curve visualization

	[10/31/16 : Build 6.33] - Semi-Automatic

		[Added semi-automatic transmission mode]
		-'TransModes' now accepts "Semi" value for semi-automatic.
		-Updated AC6_Stock_Gauges to include semi-automatic mode.

		[Fixed disengaging p-brake]
		-P-Brake now remains engaged if player gets into then vehicle.

		[Fixed FE Support for AC6_Stock_Sound]
		-Sounds should now work properly with Filtering Enabled.

	[8/5/16 : Build 6.32] - Differential System

		[Implemented differential system]
		-Differential controls torque distibution between wheels that are spinning at different rates
		-Added tune values 'FDiffSlipThres', 'FDiffLockThres', 'RDiffSlipThres', 'RDiffLockThres', 'CDiffSlipThres', and 'CDiffLockThres'.
		-'DiffSlipThres' determine the threshold of the speed difference between the wheels. Full lock applies at max threshold.
		-A lower slip threshold value will make the diff more aggressive.
		-'DiffLockThres' determines the bias of the differential.
		-A lock threshold value more than 50 puts more torque into the slipping wheel (moving towards an open diff).
		-A lock threshold value less than 50 puts more torque into the grounded wheel (moving towards a locked diff).

		[Fixed multiple wheel support]
		-The chassis can now use more than just the default 4 set of wheels. Just copy an existing wheel and place accordingly.
		-Differential works with auxiliary wheels.

	[7/13/16 : Build 6.31] - Peripheral Settings

		[Added peripheral adjustment values]
		-Moved controller and mouse deadzone values to the "Controls" section of the tune.
		-Split controller deadzone into left and right input.
		-Moved mouse control width to "Conrols" secton. This value now operates based off of % of screed width.

		[Updated stock Controls Module]
		-Added sliders for controller and mouse deadzone values.
		-Added slider for mouse control width.

	[6/15/16 : Build 6.3] - Motercisly

		[Better motorcycle system support]
		-Added wheel configurations "F" and "R" for single wheel settup.
		-"F" and "R" wheels will have axle parts on both sides for better balance.
		-These wheel configurations will ignore outor rotation value and will rotated based off of the inner rotation value only.
		-Camber and Toe cannot be applied to these wheel configurations. Caster will still be applied as normal.

		[Bug fixes]
		-Caster now applies after wheel part rotations so wheel parts dont rotate with caster.
		-Fixed Clutch re-engaging automatically when shifting out of neutral.

	[6/4/16 : Build 6.21] - AC6 Official Public Kit Release

		[Plugin FilteringEnabled compatability made easier]
		-System now detects if there is a RemoteEvent or RemoteFunction inside a plugin. These will be parented directly under the car.
		-The RemoteEvent/RemoteFunction needs to be a direct child of the plugin for it to be detected.
		-Scripts inside the RemoteEvent/RemoteFunction should be disabled. They will be enabled after initialization.
		-Be careful as this system is suceptible to name collisions. Name your RemoteEvents/RemoteFunctions uniquely.
		-Stock AC6 Sound plugin is now FE compatible.

		[Controls Panel now a plugin instead of integrated]
		-Separated controls panel from Drive script. The controls panel is now a plugin.
		-The "Controls" folder appears inside the interface on Drive startup. Use this folder to reference button mapping values for custom controls plugins.
		-"ControlsOpen" value added. This is a safety toggle when changing control values. This value can be manipulated by plugins.

		[New tune values]
		-Added 'AutoFlip' tune value. This determines if the car automatically flips itself over when upside down.
		-Added 'StAxisOffset' tune value. This offsets the center of the steering axis. Positive value = offset outward.
		-Added 'SteerD', 'SteerMaxTorque', and 'SteerP' values which set the steering axle gyro properties.

		[MiscWeld streamlining]
		-Added "Misc" section to the main sections. This should contain scripted/moving parts.
		-Parts in this section are NOT WELDED AUTOMATICALLY. Use the "MiscWeld" module to weld these parts. The "Misc" section is pre-referenced as 'misc'.

		[Bug fixes]
		-Fixed flip gyro not resetting when gyro is active and driver leaves car.
		-Fixed issue with switching transmission modes.
--]]

Response: return "6.42S"


Prompt: -- Events

Response:
local Events = ReplicatedStorage.Events
local RedeemCode = Events.RedeemCode


Prompt:
--[=[
	Given a list of brios of brios, flattens that list into a brio with
	just one T value.

	@param brioTable { any: Brio<Brio<T> | T>}
	@return Brio<{T}>
]=]

Response:
function BrioUtils.flatten(brioTable)
	local newValue = {}
	local brios = {}

	for key, brio in pairs(brioTable) do
		if Brio.isBrio(brio) then
			if brio:IsDead() then
				return Brio.DEAD
			else
				table.insert(brios, brio)
				newValue[key] = brio:GetValue()
			end
		else
			newValue[key] = brio
		end
	end

	return BrioUtils.first(brios, newValue)
end


Prompt: -- stops specific anim

Response:
function module.stopSpecific(name,hum)
	local AnimationTracks = hum:GetPlayingAnimationTracks()

	for i, track in pairs (AnimationTracks) do
		if track.Name == name then
			track:Stop()
		end
	end

end


Prompt: --end

Response:
for i, model in pairs(petModelFolder) do
	ContentProvider:PreloadAsync({model})
	Loaded += 1
	Gui.Frame.TextLabel.Text = Loaded.."/"..toLoad.. " asset loaded"
end

TweenService:Create(Gui.Frame, erase, {BackgroundTransparency = 1}):Play()

Gui.Enabled = false

StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, true)