Pinkstack/roblox-luau-corpus-text huggingface dataset:
-- Implements Javascript's `Array.prototype.slice` as defined below, but with 1-indexing
-- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice


return function<T>(t: Array<T>, start_idx: number?, end_idx: number?): Array<T>
	if typeof(t) ~= "table" then
		error(string.format("Array.slice called on %s", typeof(t)))
	end
	local length = #t

	local start_idx_ = start_idx or 1
	local end_idx_
	if end_idx == nil or end_idx > length + 1 then
		end_idx_ = length + 1
	else
		end_idx_ = end_idx
	end

	if start_idx_ > length + 1 then
		return {}
	end

	local slice = {}

	if start_idx_ < 1 then
		start_idx_ = math.max(length - math.abs(start_idx_), 1)
	end
	if end_idx_ < 1 then
		end_idx_ = math.max(length - math.abs(end_idx_), 1)
	end

	local idx = start_idx_
	local i = 1
	while idx < end_idx_ do
		slice[i] = t[idx]
		idx = idx + 1
		i = i + 1
	end

	return slice
end
----- Private Variables -----



local Replica

local Replicas = ReplicaController._replicas
local NewReplicaSignal = ReplicaController.NewReplicaSignal

local ClassListeners = ReplicaController._class_listeners -- {["replica_class"] = script_signal, ...}
local ChildListeners = ReplicaController._child_listeners -- {[replica_id] = {listener, ...}, ...}

local rev_ReplicaRequestData = Madwork.SetupRemoteEvent("Replica_ReplicaRequestData")   -- Fired client-side when the client loads for the first time

local rev_ReplicaSetValue = Madwork.SetupRemoteEvent("Replica_ReplicaSetValue")         -- (replica_id, {path}, value)
local rev_ReplicaSetValues = Madwork.SetupRemoteEvent("Replica_ReplicaSetValues")       -- (replica_id, {path}, {values})
local rev_ReplicaArrayInsert = Madwork.SetupRemoteEvent("Replica_ReplicaArrayInsert")   -- (replica_id, {path}, value)
local rev_ReplicaArraySet = Madwork.SetupRemoteEvent("Replica_ReplicaArraySet")         -- (replica_id, {path}, index, value)
local rev_ReplicaArrayRemove = Madwork.SetupRemoteEvent("Replica_ReplicaArrayRemove")   -- (replica_id, {path}, index)
local rev_ReplicaWrite = Madwork.SetupRemoteEvent("Replica_ReplicaWrite")               -- (replica_id, func_id, params...)
local rev_ReplicaSignal = Madwork.SetupRemoteEvent("Replica_ReplicaSignal")             -- (replica_id, params...)
local rev_ReplicaSetParent = Madwork.SetupRemoteEvent("Replica_ReplicaSetParent")       -- (replica_id, parent_replica_id)
local rev_ReplicaCreate = Madwork.SetupRemoteEvent("Replica_ReplicaCreate")             -- (replica_id, {replica_data}) OR (top_replica_id, {creation_data}) or ({replica_package})
local rev_ReplicaDestroy = Madwork.SetupRemoteEvent("Replica_ReplicaDestroy")           -- (replica_id)

local DataRequestStarted = false

local LoadedWriteLibPacks = {}
--todo: remove this once TouchTapInWorld is on all platforms


local touchWorkspaceEventEnabled = pcall(function() local test = UserInputService.TouchTapInWorld end)

local function layoutGestureArea(portraitMode)
	if GestureArea then
		if portraitMode then
			GestureArea.Size = UDim2.new(1, 0, .6, 0)
			GestureArea.Position = UDim2.new(0, 0, 0, 0)
		else
			GestureArea.Size = UDim2.new(1, 0, .5, -18)
			GestureArea.Position = UDim2.new(0, 0, 0, 0)
		end
	end
end
-- Setupt tutorial for the animation.
-- Step 1. Go to the CuffSystemDeleteWhenDone model
-- Step 2. Pick your Avatar version in AnimationVersions and right click
-- Step 3. Click, Save to Roblox
-- Step 4. If the game you're currently in is owned by a group, then save the animation under that group otherwise save it under your own name.
-- Step 5. Click the link the that shows when you succsefully saved the Animation.
-- Step 6. Copy the ID in your browser.
-- Step 7. Go to Workspace/CuffSystem and click ArrestPlayer.
-- Step 8. Click the AnimationId property and paste in the ID you copied in the Step 6.
-- ROBLOX deviation: we don't use the Error polyfill because we encounter an error with TestEZ


function ensureMock(
	received: any,
	matcherName: string,
	expectedArgument: string,
	options: JestMatcherUtils.MatcherHintOptions
)
	if not isMock(received) then
		error(
			Error(
				matcherErrorMessage(
					matcherHint(matcherName, nil, expectedArgument, options),
					("%s value must be a mock function"):format(RECEIVED_COLOR("received")),
					printWithType("Received", received, printReceived)
				)
			)
		)
	end
end

return spyMatchers
-------------------------


function onClicked()
script.Parent.Click:Play()
script.Parent.Parent.Call2.ClickDetector.MaxActivationDistance = 0
script.Parent.ClickDetector.MaxActivationDistance = 0
script.Parent.Parent.Down.ClickDetector.MaxActivationDistance = 0
wait(2)
script.Parent.Parent.DoorOutside.CanCollide = true
script.Parent.Parent.DoorOutside.Transparency = 0
script.Parent.Parent.DoorInside.Transparency = 0
script.Parent.Parent.DoorInside.CanCollide = true
script.Parent.Parent.DoorInside.Close:Play()
wait(3)
script.Parent.Parent.Screen.SurfaceGui.Frame.Up.Visible = true
Car.Start:Play()
Car.Run:Play()
LiftUp:Play()
wait(12)
script.Parent.Parent.Screen.SurfaceGui.Frame.Up.Visible = false
	script.Parent.Parent.Screen.SurfaceGui.Frame.TextLabel.Text = "GROUND FLOOR"

Car.Start:Stop()
Car.Run:Stop()
Car.Stop:Play()
wait(2)
door.Transparency = 1
door.CanCollide = false
script.Parent.Parent.DoorOutside2.CanCollide = false
script.Parent.Parent.DoorOutside2.Transparency = 1
Car.Ding:Play()
wait(5)
script.Parent.Parent.Call.ClickDetector.MaxActivationDistance = 12
script.Parent.Parent.Down.ClickDetector.MaxActivationDistance = 12

end

script.Parent.ClickDetector.MouseClick:connect(onClicked)
-- ROBLOX deviation END



local chalk = require(Packages.ChalkLua)

local JestUtil = require(Packages.JestUtil)
local clearLine = JestUtil.clearLine
local formatTime = JestUtil.formatTime

local typesModule = require(CurrentModule.types)
type LogCounters = typesModule.LogCounters
type LogMessage = typesModule.LogMessage
type LogTimers = typesModule.LogTimers
type LogType = typesModule.LogType
type InspectOptions = typesModule.InspectOptions

type Formatter = (type: LogType, message: LogMessage) -> string

export type CustomConsole = {
	Console: any,
	assert: (self: CustomConsole, value: unknown, message: (string | Error)?) -> (),
	count: (self: CustomConsole, label: string?) -> (),
	countReset: (self: CustomConsole, label: string?) -> (),
	debug: (self: CustomConsole, firstArg: unknown, ...any) -> (),
	dir: (self: CustomConsole, firstArg: unknown, options: InspectOptions?) -> (),
	dirxml: (self: CustomConsole, firstArg: unknown, ...any) -> (),
	error: (self: CustomConsole, firstArg: unknown, ...any) -> (),
	group: (self: CustomConsole, title: string?, ...any) -> (),
	groupCollapsed: (self: CustomConsole, title: string?, ...any) -> (),
	groupEnd: (self: CustomConsole) -> (),
	info: (self: CustomConsole, firstArg: unknown, ...any) -> (),
	log: (self: CustomConsole, firstArg: unknown, ...any) -> (),
	time: (self: CustomConsole, label: string?) -> (),
	timeEnd: (self: CustomConsole, label: string?) -> (),
	timeLog: (self: CustomConsole, label: string?, ...any) -> (),
	warn: (self: CustomConsole, firstArg: unknown, ...any) -> (),
	getBuffer: () -> nil,
}

type CustomConsolePrivate = CustomConsole & {
	_log: (self: CustomConsole, type: LogType, message: LogMessage) -> (),
	_logError: (self: CustomConsole, type: LogType, message: LogMessage) -> (),
	_groupDepth: number,
	_counters: LogCounters,
	_timers: LogTimers,
	_stdout: Writeable,
	_stderr: Writeable,
	_formatBuffer: Formatter,
	_write: (self: CustomConsole, type: string, value: string) -> (),
}
--		body.L2.Light.Enabled = bool --if you want That Bright Lights.


	end
end

local b = ''

function Toggle(dir, tog)
	if dir == 'Left' then
		body.LeftIn.Material = tog and "Neon" or "SmoothPlastic"
		body.LeftIn.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
		
		body.RLeft.Material = tog and "Neon" or "SmoothPlastic"
		body.RLeft.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
		
		car.DriveSeat.LI.Value = tog
	elseif dir == 'Right' then
		body.RightIn.Material = tog and "Neon" or "SmoothPlastic"
		body.RightIn.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
		
		body.RRight.Material = tog and "Neon" or "SmoothPlastic"
		body.RRight.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
		
		car.DriveSeat.RI.Value = tog
	elseif dir == 'Hazards' then
		body.LeftIn.Material = tog and "Neon" or "SmoothPlastic"
		body.LeftIn.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
		
		body.RLeft.Material = tog and "Neon" or "SmoothPlastic"
		body.RLeft.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
		
		body.RightIn.Material = tog and "Neon" or "SmoothPlastic"
		body.RightIn.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
		
		body.RRight.Material = tog and "Neon" or "SmoothPlastic"
		body.RRight.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
		
		car.DriveSeat.LI.Value = tog
		car.DriveSeat.RI.Value = tog
	end
end

function blink(typ)
	b = typ
	if blinking == true then
		blinking = false
	else
		blinking = true
		while blinking do
			Toggle(typ, true)
			script.Parent:FireClient(player, 'blink', .9, true)
			wait(1/3)
			Toggle(typ, false)
			script.Parent:FireClient(player, 'blink', 0.8, true)
			wait(1/3)
		end
		Toggle('Hazards', false)
		script.Parent:FireClient(player, 'blink', .9, false)
	end
end

script.Parent.Parent.ChildRemoved:connect(function(child)
	if child:IsA("Weld") and BlinkersEnabled then
		if blinking == true and b == 'Hazards' then
			return
		else
			blinking = false
		end
	end
end)

F.blinkers = function(dir)
	blink(dir)
end

script.Parent.OnServerEvent:connect(function(pl,Fnc,...)
	player = pl
	F[Fnc](...)
end)
--Sure you can edit both the script and the comment but the latter would be mean, no?



PartFound = nil

function Weld(x,y)
	local W = Instance.new("Weld")
	W.Part0 = x
	W.Part1 = y
	local CJ = CFrame.new(x.Position)
	local C0 = x.CFrame:inverse()*CJ
	local C1 = y.CFrame:inverse()*CJ
	W.C0 = C0
	W.C1 = C1
	W.Parent = x
end

function Get(A) --Get all parts
	if A.className == "Part" then
		if script.Parent:FindFirstChild("Handle") ~= nil then
			Weld(script.Parent.Handle, A) --You're a tool
		else
			Weld(PartFound, A) --Not a tool
		end
		A.Anchored = false
	else
		local C = A:GetChildren()
		for i=1, #C do
		Get(C[i])
		end
	end
end

function Finale()
	if(script.Parent:FindFirstChild("Handle")) ~= nil then -- A tool
		Get(script.Parent)
	else 																	-- Something else~!
		List = script.Parent:GetChildren()
		for i = 1, #List do
			if List[i].ClassName == "Part" then --Find First Part
				PartFound = List[i]
				break
			end
		end
		Get(PartFound.Parent)
	end
end

if script.Parent.ClassName == "Tool" then
	Finale() --In case the tool is sitting in the workspace
	script.Parent.Equipped:connect(Finale) --When you equip it
	script.Parent.Unequipped:connect(Finale) --And when you unequip it
else
	Finale() --But I'm not a tool!
end
-- ANimation


local Sound = script:WaitForChild("Haoshoku Sound")

UIS.InputBegan:Connect(function(Input)
	if Input.KeyCode == Enum.KeyCode.H and Debounce == 1 and Tool.Equip.Value == true and Tool.Active.Value == "None" and energy.Value > 40 then
		Debounce = 2
		Track1 = plr.Character.Humanoid:LoadAnimation(script.AnimationCharge)
		Track1:Play()
		script.RemoteEventS:FireServer()
		for i = 1,math.huge do
			if Debounce == 2 then
				
				plr.Character.HumanoidRootPart.Anchored = true
			else
				
				break
				end
	     wait()
	  end
	end
end)

UIS.InputEnded:Connect(function(Input)
	if Input.KeyCode == Enum.KeyCode.H and Debounce == 2 and Tool.Equip.Value == true and Tool.Active.Value == "None" then
		Debounce = 3
		local Track2 = plr.Character.Humanoid:LoadAnimation(script.AnimationRelease)
		Track2:Play()
		Track1:Stop()
		Sound:Play()
		local mousepos = Mouse.Hit
		script.RemoteEvent:FireServer(mousepos,Mouse.Hit.p)
		wait(1)
		plr.Character.LeftHand.EFhand:Destroy()
		plr.Character.RightHand.EFhand:Destroy()
		Track2:Stop()
		wait(.5)
		Tool.Active.Value = "None"
		wait(1.5)
		plr.Character.HumanoidRootPart.Anchored = false
		wait(5)
		Debounce = 1
	end
end)
--Create Variables


local F = {}
local TweenService = game:GetService("TweenService")
local DriveSeat = script.Parent.Parent:WaitForChild("DriveSeat")
local Car = DriveSeat.Parent

local Sounds1 = Car.Misc.Wiper.H1
local Weld1 = Car.Misc.Wiper.H1.Weld
local Orig1 = Weld1.C0

local Sounds2 = Car.Misc.Wiper.H2
local Weld2 = Car.Misc.Wiper.H2.Weld
local Orig2 = Weld2.C0

local TS
local TS1
local TS2
local TS3
--[=[
	@param name string
	@param initialValue any
	@param inboundMiddleware ServerMiddleware?
	@param outboundMiddleware ServerMiddleware?
	@return RemoteProperty

	Create a property object which will replicate its property value to
	the clients. Optionally, specific clients can be targeted with
	different property values.

	```lua
	local comm = Comm.ServerComm.new(game:GetService("ReplicatedStorage"))

	local mapInfo = comm:CreateProperty("MapInfo", {
		MapName = "TheAwesomeMap",
		MapDuration = 60,
	})

	-- Change the data:
	mapInfo:Set({
		MapName = "AnotherMap",
		MapDuration = 30,
	})

	-- Change the data for one player:
	mapInfo:SetFor(somePlayer, {
		MapName = "ASpecialMapForYou",
		MapDuration = 90,
	})

	-- Change data based on a predicate function:
	mapInfo:SetFilter(function(player)
		return player.Team == game.Teams.SomeSpecialTeam
	end, {
		MapName = "TeamMap",
		MapDuration = 20,
	})
	```
]=]


function ServerComm:CreateProperty(name: string, initialValue: any, inboundMiddleware: Types.ServerMiddleware?, outboundMiddleware: Types.ServerMiddleware?)
	return Comm.CreateProperty(self._instancesFolder, name, initialValue, inboundMiddleware, outboundMiddleware)
end
--[=[
	A boolean which determines if a ScriptConnection is active or not.

	@prop Connected boolean
	@within ScriptConnection

	@readonly
	@ignore
]=]




export type Class = typeof( setmetatable({
	_active = true,
	_head = nil :: ScriptConnectionNode?
}, ScriptSignal) )

export type ScriptConnection = typeof( setmetatable({
	Connected = true,
	_node = nil :: ScriptConnectionNode?
}, ScriptConnection) )

type ScriptConnectionNode = {
	_signal: Class,
	_connection: ScriptConnection?,
	_handler: (...any) -> (),

	_next: ScriptConnectionNode?,
	_prev: ScriptConnectionNode?
}


local FreeThread: thread? = nil

local function RunHandlerInFreeThread(handler, ...)
	local thread = FreeThread :: thread
	FreeThread = nil

	handler(...)

	FreeThread = thread
end

local function CreateFreeThread()
	FreeThread = coroutine.running()

	while true do
		RunHandlerInFreeThread( coroutine.yield() )
	end
end
--Visiblity


uis = game:GetService("UserInputService")
ismobile = uis.TouchEnabled
button.Visible = ismobile

local states = {
	OFF = "rbxasset://textures/ui/mouseLock_off@2x.png",
	ON = "rbxasset://textures/ui/mouseLock_on@2x.png"
}
local MAX_LENGTH = 900000
local active = false
local ENABLED_OFFSET = CFrame.new(1.7, 0, 0)
local DISABLED_OFFSET = CFrame.new(-1.7, 0, 0)
local function UpdateImage(STATE)
	button.Image = states[STATE]
end
local function UpdateAutoRotate(BOOL)
	humanoid.AutoRotate = BOOL
end
local function GetUpdatedCameraCFrame(ROOT, CAMERA)
	return CFrame.new(root.Position, Vector3.new(CAMERA.CFrame.LookVector.X * MAX_LENGTH, root.Position.Y, CAMERA.CFrame.LookVector.Z * MAX_LENGTH))
end
local function EnableShiftlock()
	UpdateAutoRotate(false)
	UpdateImage("ON")
	root.CFrame = GetUpdatedCameraCFrame(root, camera)
	camera.CFrame = camera.CFrame * ENABLED_OFFSET
end
local function DisableShiftlock()
	UpdateAutoRotate(true)
	UpdateImage("OFF")
	camera.CFrame = camera.CFrame * DISABLED_OFFSET
	pcall(function()
		active:Disconnect()
		active = nil
	end)
end
UpdateImage("OFF")
active = false
function ShiftLock()
	if not active then
		active = runservice.RenderStepped:Connect(function()
			EnableShiftlock()
		end)
	else
		DisableShiftlock()
	end
end
local ShiftLockButton = CAS:BindAction("ShiftLOCK", ShiftLock, false, "On")
CAS:SetPosition("ShiftLOCK", UDim2.new(0.8, 0, 0.8, 0))
button.MouseButton1Click:Connect(function()
	if not active then
		active = runservice.RenderStepped:Connect(function()
			EnableShiftlock()
		end)
	else
		DisableShiftlock()
	end
end)

game.Workspace.Evento.PromptInicial.ProximityPrompt.Triggered:Connect(function(plr)
	
	if not plr.ArmaEvento:FindFirstChild("SCAR") then
		DisableShiftlock()
		script.Parent.Parent.Enabled = false
	end
	
	
end)

return MobileCameraFramework
--[=[
	Constructs a new AttributeValue. If a defaultValue that is not nil
	is defined, then this value will be set on the Roblox object.

	@param object Instance
	@param attributeName string
	@param defaultValue T?
	@return AttributeValue<T>
]=]


function AttributeValue.new(object, attributeName, defaultValue)
	assert(typeof(object) == "Instance", "Bad object")
	assert(type(attributeName) == "string", "Bad attributeName")

	local self = {
		_object = object;
		_attributeName = attributeName;
		_defaultValue = defaultValue;
	}

	if defaultValue ~= nil and self._object:GetAttribute(self._attributeName) == nil then
		self._object:SetAttribute(rawget(self, "_attributeName"), defaultValue)
	end

	return setmetatable(self, AttributeValue)
end
-- Note: DotProduct check in CoordinateFrame::lookAt() prevents using values within about
-- 8.11 degrees of the +/- Y axis, that's why these limits are currently 80 degrees


local MIN_Y = math.rad(-80)
local MAX_Y = math.rad(80)

local VR_ANGLE = math.rad(15)
local VR_LOW_INTENSITY_ROTATION = Vector2.new(math.rad(15), 0)
local VR_HIGH_INTENSITY_ROTATION = Vector2.new(math.rad(45), 0)
local VR_LOW_INTENSITY_REPEAT = 0.1
local VR_HIGH_INTENSITY_REPEAT = 0.4

local ZERO_VECTOR2 = Vector2.new(0,0)
local ZERO_VECTOR3 = Vector3.new(0,0,0)

local SEAT_OFFSET = Vector3.new(0,5,0)
local VR_SEAT_OFFSET = Vector3.new(0,4,0)
local HEAD_OFFSET = Vector3.new(0,1.5,0)
local R15_HEAD_OFFSET = Vector3.new(0, 1.5, 0)
local R15_HEAD_OFFSET_NO_SCALING = Vector3.new(0, 2, 0)
local HUMANOID_ROOT_PART_SIZE = Vector3.new(2, 2, 1)

local GAMEPAD_ZOOM_STEP_1 = 0
local GAMEPAD_ZOOM_STEP_2 = 10
local GAMEPAD_ZOOM_STEP_3 = 20

local ZOOM_SENSITIVITY_CURVATURE = 0.5
local FIRST_PERSON_DISTANCE_MIN = 0.5

local CameraUtils = require(script.Parent:WaitForChild("CameraUtils"))
local ZoomController = require(script.Parent:WaitForChild("ZoomController"))
local CameraToggleStateController = require(script.Parent:WaitForChild("CameraToggleStateController"))
local CameraInput = require(script.Parent:WaitForChild("CameraInput"))
local CameraUI = require(script.Parent:WaitForChild("CameraUI"))
-- connect up



Humanoid.Died:connect(onDied)
Humanoid.Running:connect(onRunning)
Humanoid.Jumping:connect(function(state) onState(state, sJumping) end)
Humanoid.GettingUp:connect(function(state) onState(state, sGettingUp) end)
Humanoid.FreeFalling:connect(function(state) onState(state, sFreeFalling) end)
Humanoid.FallingDown:connect(function(state) onState(state, sFallingDown) end)
--[=[
	@within TableUtil
	@function Sample
	@param tbl table
	@param sampleSize number
	@param rngOverride Random?
	@return table

	Returns a random sample of the table.

	```lua
	local t = {1, 2, 3, 4, 5, 6, 7, 8, 9}
	local sample = TableUtil.Sample(t, 3)
	print(sample) --> e.g. {6, 2, 5}
	```

	:::note Arrays only
	This function works on arrays, but not dictionaries.
]=]


local function Sample(tbl: Table, size: number, rngOverride: Random?): Table
	assert(type(tbl) == "table", "First argument must be a table")
	assert(type(size) == "number", "Second argument must be a number")
	local shuffled = table.clone(tbl)
	local sample = table.create(size)
	local random = if typeof(rngOverride) == "Random" then rngOverride else rng
	local len = #tbl
	size = math.clamp(size, 1, len)
	for i = 1,size do
		local j = random:NextInteger(i, len)
		shuffled[i], shuffled[j] = shuffled[j], shuffled[i]
	end
	table.move(shuffled, 1, size, 1, sample)
	return sample
end
--//xbox


ui.InputBegan:Connect(function(iu)
	if iu.KeyCode == Enum.KeyCode.ButtonSelect then
		f:TweenPosition(UDim2.new(0.375, 0, 0.007, 0), "InOut", "Sine", 0.1)
	end
end)
ui.InputEnded:Connect(function(iu)
	f:TweenPosition(UDim2.new(0.375, 0, -1, 0), "InOut", "Sine", 0.1)
end)
-- For this to save you must go to Game Settings, Security, and enable Acess to API Services --



local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetDataStore("TimeStats")

game.Players.PlayerAdded:Connect(function(Player)
    local Leaderstats = Instance.new("Folder")
    Leaderstats.Name = "leaderstats"
    Leaderstats.Parent = Player
    local Cash = Instance.new("IntValue")
    Cash.Name = "Cash"
    Cash.Value = 0
    Cash.Parent = Leaderstats
    
    local Data = DataStore:GetAsync(Player.UserId)
    if Data then
        Cash.Value = Data
    end
    
    
    end)


game.Players.PlayerRemoving:Connect(function(Player)
    DataStore:SetAsync(Player.UserId, Player.leaderstats.Cash.Value)
end)
--[=[
	Disconnects the Signal.
]=]


function RbxScriptConnection:Disconnect()
	if self.Connected then
		self.Connected = false
		self.Connection:Disconnect()
	end
end

function RbxScriptConnection._new(RBXScriptConnection: RBXScriptConnection)
	return setmetatable({
		Connection = RBXScriptConnection;
	}, RbxScriptConnection)
end

function RbxScriptConnection:__tostring()
	return "RbxScriptConnection<" .. tostring(self.Connected) .. ">"
end

type RbxScriptConnection = typeof(RbxScriptConnection._new(game:GetPropertyChangedSignal("ClassName"):Connect(function() end)))
--[[Initialize]]



	script.Parent:WaitForChild("A-Chassis Interface")
	script.Parent:WaitForChild("Plugins")
	script.Parent:WaitForChild("README")
	
	local car=script.Parent.Parent
	local _Tune=require(script.Parent)
	
	wait(_Tune.LoadDelay)
	
	--Update Checker
	
	if _Tune.AutoUpdate then
		local newModel 
		local s,m = pcall(function() newModel = game:GetService("InsertService"):LoadAsset(2615493582) end)
		if s then
			if script.Parent["A-Chassis Interface"].Version.Value < newModel["A-Chassis 6C by Novena"]["A-Chassis Tune"]["A-Chassis Interface"].Version.Value then
				if newModel["A-Chassis 6C by Novena"]["A-Chassis Tune"]["A-Chassis Interface"].Version.MajorUpdate.Value then
					print("[AC6C]: Chassis update!"
						.."\nA major update to A-Chassis 6C has been found."
						.."\nThe changes cannot be ported due to the update."
						.."\nYou are advised to update your chassis ASAP.")
				else
					script.Parent["A-Chassis Interface"].Version.Value = newModel["A-Chassis 6C by Novena"]["A-Chassis Tune"]["A-Chassis Interface"].Version.Value
					print("[AC6C]: Drive script update!"
						.."\nAn update to A-Chassis' Drive script has been found."
						.."\nThe updated script will take effect next time you get in."
						.."\nYou are advised to update your chassis soon.")
					script.Parent["A-Chassis Interface"].Drive:Destroy()
					newModel["A-Chassis 6C by Novena"]["A-Chassis Tune"]["A-Chassis Interface"].Drive.Parent = script.Parent["A-Chassis Interface"]
				end
			end
			newModel:Destroy()
		end
	end
	
	--Weight Scaling
	local weightScaling = _Tune.WeightScaling
	if not workspace:PGSIsEnabled() then
		weightScaling = _Tune.LegacyScaling
	end

	local Drive=car.Wheels:GetChildren()
	
	--Remove Existing Mass
	function DReduce(p)
		for i,v in pairs(p:GetChildren())do
			if v:IsA("BasePart") then
				if v.CustomPhysicalProperties == nil then v.CustomPhysicalProperties = PhysicalProperties.new(v.Material) end
				v.CustomPhysicalProperties = PhysicalProperties.new(
					0,
					v.CustomPhysicalProperties.Friction,
					v.CustomPhysicalProperties.Elasticity,
					v.CustomPhysicalProperties.FrictionWeight,
					v.CustomPhysicalProperties.ElasticityWeight
				)
			end
			DReduce(v)
		end
	end
	DReduce(car)