Pinkstack/roblox-luau-corpus-text huggingface dataset:
--Internal functions


function DataStore:Debug(...)
	if self.debug then
		print(...)
	end
end

function DataStore:_GetRaw()
	if not self.getQueue then
		self.getQueue = Instance.new("BindableEvent")
	end

	if self.getting then
		self:Debug("A _GetRaw is already in motion, just wait until it's done")
		self.getQueue.Event:wait()
		self:Debug("Aaand we're back")
		return
	end

	self.getting = true

	local success, value = self.savingMethod:Get()

	self.getting = false
	if not success then
		error(tostring(value))
	end

	self.value = value

	self:Debug("value received")
	self.getQueue:Fire()

	self.haveValue = true
end

function DataStore:_Update(dontCallOnUpdate)
	if not dontCallOnUpdate then
		for _,callback in pairs(self.callbacks) do
			callback(self.value, self)
		end
	end

	self.haveValue = true
	self.valueUpdated = true
end
-----------------------------------



ba=Instance.new("Part")
ba.CastShadow = false
ba.TopSurface=0
ba.BottomSurface=0
ba.Anchored=false
ba.CanCollide=false
ba.formFactor="Custom"
ba.Size=Vector3.new(1,0.1,1)
ba.CFrame=CFrame.new(script.Parent.CFrame.p)*CFrame.fromEulerAnglesXYZ(math.pi/2,0,0)
ba.Name="Effect"
ba.BrickColor=BrickColor.new "White"
ao=script.RingMesh:clone()
ao.Parent = ba
local fade = script.RingFade:Clone()
fade.Parent = ba
fade.Disabled = false
ba.Parent=script.Parent

fo=Instance.new("BodyPosition")
fo.maxForce= Vector3.new (99999999999999999,99999999999999999,99999999999999999)
fo.position = ba.Position
fo.Parent = ba
aa=Instance.new("BodyAngularVelocity")
aa.P=3000
aa.maxTorque=aa.maxTorque*30
aa.angularvelocity=Vector3.new(math.random(-70,70)/3,math.random(-70,70)/3,math.random(-70,70)/5)*100
aa.Parent=ba
--run this first so if there is a 'white' team it is switched over


if not Settings['AutoAssignTeams'] then
	local teamHire = Instance.new('Team', Teams)
	teamHire.TeamColor = BC.new('White')
	teamHire.Name = "For Hire"
end

for i,v in pairs(script.Parent:WaitForChild('Tycoons'):GetChildren()) do
	Tycoons[v.Name] = v:Clone() -- Store the tycoons then make teams depending on the tycoon names
	if returnColorTaken(v.TeamColor) then
		--//Handle duplicate team colors
		local newColor;
		repeat
			wait()
			newColor = BC.Random()
		until returnColorTaken(newColor) == false
		v.TeamColor.Value = newColor
	end
	--Now that there are for sure no duplicates, make your teams
	local NewTeam = Instance.new('Team',Teams)
	NewTeam.Name = v.Name
	NewTeam.TeamColor = v.TeamColor.Value
	if not Settings['AutoAssignTeams'] then
		NewTeam.AutoAssignable = false
	end
	v.PurchaseHandler.Disabled = false
end

function getPlrTycoon(player)
	for i,v in pairs(script.Parent.Tycoons:GetChildren()) do
		if v:IsA("Model") then
			if v.Owner.Value == player then
				return v
			end
		end
	end
	return nil
end

game.Players.PlayerAdded:connect(function(player)
	local plrStats = Instance.new("NumberValue",game.ServerStorage.PlayerMoney)
	plrStats.Name = player.Name
	local isOwner = Instance.new("ObjectValue",plrStats)
	isOwner.Name = "OwnsTycoon"
end)

game.Players.PlayerRemoving:connect(function(player)
	local plrStats = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
	if plrStats ~= nil then
		plrStats:Destroy()
	end
	local tycoon = getPlrTycoon(player)
	if tycoon then
		local backup = Tycoons[tycoon.Name]:Clone()
		tycoon:Destroy()
		wait()
		backup.Parent=script.Parent.Tycoons
	end
end)
--[[ UI FUNCTION ]]

--

local function AddUI(pl)
	script.SoftShutdown:Clone().Parent = pl:WaitForChild("PlayerGui")
	local PlayerGui = pl:WaitForChild("PlayerGui")
	local Frame = PlayerGui:WaitForChild("SoftShutdown").Frame
	Frame:TweenPosition(UDim2.new(0,0,0,0),"In","Quad",.5,true)
end
-----------------------------------------


while true do -- Makes a loop
brick.CFrame = brick.CFrame + Vector3.new (moveX, moveY, moveZ) -- Up we go! :D
wait (time)
brick.CFrame = brick.CFrame + Vector3.new (moveX, moveY, moveZ) -- Up we go! :D
wait (time)
brick.CFrame = brick.CFrame + Vector3.new (moveX, moveY, moveZ) -- Up we go! :D
wait (time)
brick.CFrame = brick.CFrame + Vector3.new (moveX, moveY, moveZ) -- Up we go! :D
wait (time)
brick.CFrame = brick.CFrame + Vector3.new (moveX, moveY, moveZ) -- Up we go! :D
wait (time)
brick.CFrame = brick.CFrame + Vector3.new (moveX, moveY, moveZ) -- Up we go! :D
wait (time)
brick.CFrame = brick.CFrame + Vector3.new (moveX, moveY, moveZ) -- Up we go! :D
wait (time)
brick.CFrame = brick.CFrame + Vector3.new (moveX, moveY, moveZ) -- Up we go! :D
wait (time)
brick.CFrame = brick.CFrame + Vector3.new (moveX, moveY, moveZ) -- Up we go! :D
wait (time)
brick.CFrame = brick.CFrame + Vector3.new (moveX, moveY, moveZ) -- Up we go! :D
wait (time)
brick.CFrame = brick.CFrame + Vector3.new (moveX, moveY, moveZ) -- Up we go! :D
wait (time)

brick.CFrame = brick.CFrame - Vector3.new (moveX, moveY, moveZ) -- Downzy Wonzy
wait (time)
brick.CFrame = brick.CFrame - Vector3.new (moveX, moveY, moveZ) -- Downzy Wonzy
wait (time)
brick.CFrame = brick.CFrame - Vector3.new (moveX, moveY, moveZ) -- Downzy Wonzy
wait (time)
brick.CFrame = brick.CFrame - Vector3.new (moveX, moveY, moveZ) -- Downzy Wonzy
wait (time)
brick.CFrame = brick.CFrame - Vector3.new (moveX, moveY, moveZ) -- Downzy Wonzy
wait (time)
brick.CFrame = brick.CFrame - Vector3.new (moveX, moveY, moveZ) -- Downzy Wonzy
wait (time)
brick.CFrame = brick.CFrame - Vector3.new (moveX, moveY, moveZ) -- Downzy Wonzy
wait (time)
brick.CFrame = brick.CFrame - Vector3.new (moveX, moveY, moveZ) -- Downzy Wonzy
wait (time)
brick.CFrame = brick.CFrame - Vector3.new (moveX, moveY, moveZ) -- Downzy Wonzy
wait (time)
brick.CFrame = brick.CFrame - Vector3.new (moveX, moveY, moveZ) -- Downzy Wonzy
wait (time)
brick.CFrame = brick.CFrame - Vector3.new (moveX, moveY, moveZ) -- Downzy Wonzy
wait (time)
end
--- Gamepass purchase prompted!


_L.Services.MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, gamepassId, purchased)
	if player then
		--- Did player complete transaction?
		if purchased == true then
			--- Player bought gamepass! WHAT A MASSIVE LEGEND
			AddGamepass(player, gamepassId)
			
			--- Let client know purchase went through
			_L.Network.Fire("Gamepass Bought", player, gamepassId)
		end
	end
end)
--[[[Default Controls]]


	--Peripheral Deadzones
	Tune.Peripherals = {
		MSteerWidth				= 67		,	-- Mouse steering control width	(0 - 100% of screen width)
		MSteerDZone				= 10		,	-- Mouse steering deadzone (0 - 100%)
		
		ControlLDZone			= 5			,	-- Controller steering L-deadzone (0 - 100%)
		ControlRDZone			= 5			,	-- Controller steering R-deadzone (0 - 100%)
	}
	
	--Control Mapping
	Tune.Controls = {
		
	--Keyboard Controls
		--Mode Toggles
		ToggleTCS				= Enum.KeyCode.T					,
		ToggleABS				= Enum.KeyCode.Y					,
		ToggleTransMode			= Enum.KeyCode.M					,
		ToggleMouseDrive		= Enum.KeyCode.R					,
		
		--Primary Controls
		Throttle				= Enum.KeyCode.W					,
		Brake					= Enum.KeyCode.S					,
		SteerLeft				= Enum.KeyCode.A					,
		SteerRight				= Enum.KeyCode.D   				    ,
		
		--Secondary Controls
		Throttle2				= Enum.KeyCode.B 					,
		Brake2					= Enum.KeyCode.N					,
		SteerLeft2				= Enum.KeyCode.M 	 				,
		SteerRight2				= Enum.KeyCode.V					,
		
		--Manual Transmission
		ShiftUp					= Enum.KeyCode.E					,
		ShiftDown				= Enum.KeyCode.Q					,
		Clutch					= Enum.KeyCode.LeftControl     			,
		
		--Handbrake
		PBrake					= Enum.KeyCode.LeftShift			,
		
	--Mouse Controls
		MouseThrottle			= Enum.UserInputType.MouseButton1	,
		MouseBrake				= Enum.UserInputType.MouseButton2	,
		MouseClutch				= Enum.KeyCode.W					,
		MouseShiftUp			= Enum.KeyCode.E					,
		MouseShiftDown			= Enum.KeyCode.Q					,
		MousePBrake				= Enum.KeyCode.LeftShift			,
		
	--Controller Mapping
		ContlrThrottle			= Enum.KeyCode.ButtonR2				,
		ContlrBrake				= Enum.KeyCode.ButtonL2				,
		ContlrSteer				= Enum.KeyCode.Thumbstick1			,
		ContlrShiftUp			= Enum.KeyCode.ButtonY				,
		ContlrShiftDown			= Enum.KeyCode.ButtonX				,
		ContlrClutch			= Enum.KeyCode.ButtonR1				,
		ContlrPBrake			= Enum.KeyCode.ButtonL1				,
		ContlrToggleTMode		= Enum.KeyCode.DPadUp				,
		ContlrToggleTCS			= Enum.KeyCode.DPadDown				,
		ContlrToggleABS			= Enum.KeyCode.DPadRight			,
	}
--// Aim|Zoom|Sensitivity Customization


	ZoomSpeed = 0.25; -- The lower the number the slower and smoother the tween
	AimZoom = 35; -- Default zoom
	AimSpeed = 0.45;
	UnaimSpeed = 0.35;
	CycleAimZoom = 35; -- Cycled zoom
	MouseSensitivity = 0.5; -- Number between 0.1 and 1
	SensitivityIncrement = 0.05; -- No touchy
--[=[
	`Start` is called when the component is started. At this point in time, it
	is safe to grab other components also bound to the same instance.

	```lua
	local MyComponent = Component.new({Tag = "MyComponent"})
	local AnotherComponent = require(somewhere.AnotherComponent)

	function MyComponent:Start()
		-- e.g., grab another component:
		local another = self:GetComponent(AnotherComponent)
	end
	```
]=]


function Component:Start()
end
--	local player = Players.LocalPlayer -- локальный игрок


	-- print("Develop 1")
	game:GetService("MarketplaceService"):PromptProductPurchase(localPlayer,id) -- выполнение запроса покупки	
	-- print("Develop 2")
end)

while true do
	wait()
	dev = plr:FindFirstChild("Develop")
	if dev ~= nil then
		-- warn(dev," found")
		local id=script.Name
		tmp = dev:FindFirstChild(id)
		if tmp ~= nil then
			-- warn(tmp," found")
			act=script.Parent.Activat
			osTime= os.time()
			-- warn("====>>>>",osTime,"{}",tmp.Value)
			if osTime > tmp.Value then
				act.Text = "not active"
				act.TextColor3 = Color3.fromRGB(127,127,127)
			else
				tt= tmp.Value-osTime
				mm = math.floor(tt/60)
				if mm < 10 then
					mm = "0" .. tostring(mm)
				else
					mm = tostring(mm)
				end
				ss = math.fmod(tt,60)
				if ss < 10 then
					ss = "0" .. tostring(ss)
				else
					ss = tostring(ss)
				end
				act.Text = "Activated [" .. mm .. ":" .. ss  .. "]"
				act.TextColor3 = Color3.fromRGB(255,127,0)
			end
		end
	end
end
-- local SNAPSHOT_VERSION_WARNING = chalk.yellow(
-- 	chalk.bold('Warning') .. ": Before you upgrade snapshots, " ..
-- 	"we recommend that you revert any local changes to tests or other code, " ..
-- 	"to ensure that you do not store invalid state."
-- )



local normalizeNewLines, deepMerge

local function writeSnapshotVersion()
	return "-- Jest Roblox Snapshot v" .. SNAPSHOT_VERSION .. ", " .. SNAPSHOT_GUIDE_LINK
end
--now, load the zone & music data into the script



local zones = {}
local music = {}
local globali

if settings.UseMusicZones == true then
	for i,zone in pairs(zonesfolder:GetChildren()) do
		if zone:IsA("Model") and zone:FindFirstChild("Music") then
			music[i] = {}
			for _,sound in pairs(zone.Music:GetChildren()) do --save all of the music data for this zone
				if sound:IsA("Sound") then
					table.insert(music[i], {["SoundId"] = sound.SoundId, ["Volume"] = sound.Volume, ["Pitch"] = sound.Pitch})
				end
			end

			zones[i] = {
				["Priority"] = zone:FindFirstChild("Priority") and zone.Priority.Value or 1,
				["Parts"] = {},
				["Music"] = music[i]
			}

			for _,part in pairs(zone:GetChildren()) do
				if part:IsA("Part") then

					if IsCleanRotation({part.Rotation.X,part.Rotation.Y,part.Rotation.Z}) == true then --store the min and max X/Y/Z position coordinates of this part
						local lx,ly,lz = math.huge,math.huge,math.huge
						local mx,my,mz = -math.huge,-math.huge,-math.huge
						local function ApplyValues(p)
							if p.x < lx then lx = p.x end
							if p.x > mx then mx = p.x end
							if p.y < ly then ly = p.y end
							if p.y > my then my = p.y end
							if p.z < lz then lz = p.z end
							if p.z > mz then mz = p.z end
						end
						local points = {}
						--a bunch of sloppy math stuff to calculate the coordinates on each of the part's faces so we can figure out the min and max values. mathematicians, pls don't kill me if i'm doing this terribly
						local cf1 = part.CFrame
						local cf2 = (part.CFrame * CFrame.Angles(0,math.pi/2,0))
						local cf3 = (part.CFrame * CFrame.Angles(math.pi/2,0,0))
						local lvz = (cf1.lookVector * (part.Size.Z/2))
						local lvx = (cf2.lookVector * (part.Size.X/2))
						local lvy = (cf3.lookVector * (part.Size.Y/2))
						points[1] = cf1+lvz
						points[2] = cf1-lvz
						points[3] = cf2+lvx
						points[4] = cf2-lvx
						points[5] = cf3+lvy
						points[6] = cf3-lvy
						for _,p in pairs(points) do
							ApplyValues(p)
						end 
						table.insert(zones[i]["Parts"],{["Coordinates"] = {lx=lx,ly=ly,lz=lz, mx=mx,my=my,mz=mz}})
					else --save a reference to the part itself to be used for GetTouchingParts(), since it has a complex rotation that can't be solved with my own feeble calculations
						table.insert(zones[i]["Parts"],{["Part"] = part})
					end

				end
			end
		end
	end
end

if settings.UseGlobalBackgroundMusic == true then
	globali = #music + 1
	music[globali] = {}
	for _,sound in pairs(globalfolder:GetChildren()) do
		if sound:IsA("Sound") then
			table.insert(music[globali], {["SoundId"] = sound.SoundId, ["Volume"] = sound.Volume, ["Pitch"] = sound.Pitch})
		end
	end
end
--[[Brakes]]


	Tune.ABSEnabled		= true		-- Implements ABS
	Tune.ABSThreshold	= 20		-- Slip speed allowed before ABS starts working (in SPS) 

	Tune.FBrakeForce	= 1500		-- Front brake force
	Tune.RBrakeForce	= 1000		-- Rear brake force
	Tune.PBrakeForce	= 10000		-- Handbrake force
	
	Tune.FLgcyBForce	= 15000		-- Front brake force [PGS OFF]
	Tune.RLgcyBForce	= 10000		-- Rear brake force [PGS OFF]
	Tune.LgcyPBForce	= 25000		-- Handbrake force [PGS OFF]
--[=[
	Constructs a new AccelTween.

	```lua
	local accelTween = AccelTween.new(30)
	accelTween.t = 1

	conn = RunService.RenderStepped:Connect(function()
		print(accelTween.p)
	end)
	task.delay(accelTween.rtime, function()
		conn:Disconnect()
	end)
	```

	@param maxaccel number? -- The maximum acceleration applied to reach its target. Defaults to 1
	@return AccelTween
]=]


function AccelTween.new(maxaccel)
	local self = setmetatable({
		_accel = maxaccel or 1;
		_t0 = 0;
		_y0 = 0;
		_a0 = 0;
		_t1 = 0;
		_y1 = 0;
		_a1 = 0;
	}, AccelTween)

	return self
end
-- Returns the names of the winner(s) according to most points scored


function PlayerManager.getWinnerNames()
	if #activePlayers >= 1 then
		local topScore = -1
		local winnerNames = {}
		
		for i, player in pairs(activePlayers) do
			local playerScore = leaderboardManager:getStat(player, "Points").Value 
			if playerScore then
				if playerScore > topScore then
					winnerNames = {player.Name}
				elseif playerScore == topScore then
					table.insert(winnerNames, player.Name)
				end
			end
		end
		
		return winnerNames
	else
		return {}	
	end
end
--
-- Verify that everything is where it should be


assert(Self:FindFirstChild'Humanoid' ~= nil, 'Monster does not have a humanoid')
assert(Settings ~= nil, 'Monster does not have a Configurations object')
	assert(Settings:FindFirstChild'MaximumDetectionDistance' ~= nil and Settings.MaximumDetectionDistance:IsA'NumberValue', 'Monster does not have a MaximumDetectionDistance (NumberValue) setting')
	assert(Settings:FindFirstChild'CanGiveUp' ~= nil and Settings.CanGiveUp:IsA'BoolValue', 'Monster does not have a CanGiveUp (BoolValue) setting')
	assert(Settings:FindFirstChild'CanRespawn' ~= nil and Settings.CanRespawn:IsA'BoolValue', 'Monster does not have a CanRespawn (BoolValue) setting')
	assert(Settings:FindFirstChild'SpawnPoint' ~= nil and Settings.SpawnPoint:IsA'Vector3Value', 'Monster does not have a SpawnPoint (Vector3Value) setting')
	assert(Settings:FindFirstChild'AutoDetectSpawnPoint' ~= nil and Settings.AutoDetectSpawnPoint:IsA'BoolValue', 'Monster does not have a AutoDetectSpawnPoint (BoolValue) setting')
	assert(Settings:FindFirstChild'FriendlyTeam' ~= nil and Settings.FriendlyTeam:IsA'BrickColorValue', 'Monster does not have a FriendlyTeam (BrickColorValue) setting')
	assert(Settings:FindFirstChild'AttackDamage' ~= nil and Settings.AttackDamage:IsA'NumberValue', 'Monster does not have a AttackDamage (NumberValue) setting')
	assert(Settings:FindFirstChild'AttackFrequency' ~= nil and Settings.AttackFrequency:IsA'NumberValue', 'Monster does not have a AttackFrequency (NumberValue) setting')
	assert(Settings:FindFirstChild'AttackRange' ~= nil and Settings.AttackRange:IsA'NumberValue', 'Monster does not have a AttackRange (NumberValue) setting')
assert(Mind ~= nil, 'Monster does not have a Mind object')
	assert(Mind:FindFirstChild'CurrentTargetHumanoid' ~= nil and Mind.CurrentTargetHumanoid:IsA'ObjectValue', 'Monster does not have a CurrentTargetHumanoid (ObjectValue) mind setting')
assert(Self:FindFirstChild'Respawn' and Self.Respawn:IsA'BindableFunction', 'Monster does not have a Respawn BindableFunction')
assert(Self:FindFirstChild'Died' and Self.Died:IsA'BindableEvent', 'Monster does not have a Died BindableEvent')
assert(Self:FindFirstChild'Respawned' and Self.Died:IsA'BindableEvent', 'Monster does not have a Respawned BindableEvent')
assert(Self:FindFirstChild'Attacked' and Self.Died:IsA'BindableEvent', 'Monster does not have a Attacked BindableEvent')
assert(script:FindFirstChild'Attack' and script.Attack:IsA'Animation', 'Monster does not have a MonsterScript.Attack Animation')
--!strict


local Players = game:GetService("Players")

local NAME_COLORS =
	{
		Color3.new(253/255, 41/255, 67/255), -- BrickColor.new("Bright red").Color,
		Color3.new(1/255, 162/255, 255/255), -- BrickColor.new("Bright blue").Color,
		Color3.new(2/255, 184/255, 87/255), -- BrickColor.new("Earth green").Color,
		BrickColor.new("Bright violet").Color,
		BrickColor.new("Bright orange").Color,
		BrickColor.new("Bright yellow").Color,
		BrickColor.new("Light reddish violet").Color,
		BrickColor.new("Brick yellow").Color,
	}

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

local color_offset = 0

local function ComputeNameColor(pName)
	return NAME_COLORS[((GetNameValue(pName) + color_offset) % #NAME_COLORS) + 1]
end

local function GetNameColor(userId: number): Color3
	local player: Player = Players:GetPlayerByUserId(userId)
	
	return ComputeNameColor(player.Name)
end

return GetNameColor
--[[Weight and CG]]


	Tune.Weight			= 2800		-- Total weight (in pounds)
	Tune.WeightBSize	= {			-- Size of weight brick (dimmensions in studs ; larger = more stable)
	 --[[Width]]		6		,
	 --[[Height]]		3.5		,
	 --[[Length]]		14		}
	Tune.WeightDist		= 50		-- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
	Tune.CGHeight		= .8		-- Center of gravity height (studs relative to median of all wheels)
	Tune.WBVisible		= false		-- Makes the weight brick visible
	
	--Unsprung Weight
	Tune.FWheelDensity	= .1		-- Front Wheel Density
	Tune.RWheelDensity	= .1		-- Rear Wheel Density
	Tune.FWLgcyDensity	= 1			-- Front Wheel Density [PGS OFF]
	Tune.RWLgcyDensity	= 1			-- Rear Wheel Density [PGS OFF]
	
	Tune.AxleSize		= 2			-- Size of structural members (larger = more stable/carry more weight)
	Tune.AxleDensity	= .1		-- Density of structural members
-- VERTICE FUNCTIONS



local function fromIndexArray(array)
	local output = {}
	for i = 1, #array do
		output[i] = CORNERS[array[i]]
	end
	return output
end

local function cylinder(n)
	local output = {}
	local arc = PI2 / n
	for i = 1, n do
		local vi = CFrame.fromAxisAngle(RIGHT, i*arc) * UP
		output[i] = RIGHT + vi
		output[n + i] = LEFT + vi
	end
	return output
end

local function icoSphere(n)
	local verts = {
		Vector3.new(-1,  PHI, 0),
		Vector3.new(1,  PHI, 0),
		Vector3.new(-1, -PHI, 0),
		Vector3.new(1, -PHI, 0),
		
		Vector3.new(0, -1,  PHI),
		Vector3.new(0,  1,  PHI),
		Vector3.new(0, -1, -PHI),
		Vector3.new(0,  1, -PHI),
		
		Vector3.new(PHI, 0, -1),
		Vector3.new(PHI, 0,  1),
		Vector3.new(-PHI, 0, -1),
		Vector3.new(-PHI, 0,  1)
	}
	
	local indices = {
		1, 12, 6,
		1, 6, 2,
		1, 2, 8,
		1, 8, 11,
		1, 11, 12,
		
		2, 6, 10,
		6, 12, 5,
		12, 11, 3,
		11, 8, 7,
		8, 2, 9,
		
		4, 10, 5,
		4, 5, 3,
		4, 3, 7,
		4, 7, 9,
		4, 9, 10,
		
		5, 10, 6,
		3, 5, 12,
		7, 3, 11,
		9, 7, 8,
		10, 9, 2
	}
	
	local splits = {}
	
	local function split(i, j)
		local key = i < j and (i .. "," .. j) or (j .. "," .. i)
		
		if (not splits[key]) then
			verts[#verts+1] = (verts[i] + verts[j]) / 2
			splits[key] = #verts
		end
		
		return splits[key]
	end
	
	for _ = 1, n do
		for  i = #indices, 1, -3 do
			local v1, v2, v3 = indices[i - 2], indices[i - 1], indices[i]
			local a = split(v1, v2)
			local b = split(v2, v3)
			local c = split(v3, v1)
			
			indices[#indices+1] = v1
			indices[#indices+1] = a
			indices[#indices+1] = c
			
			indices[#indices+1] = v2
			indices[#indices+1] = b
			indices[#indices+1] = a
			
			indices[#indices+1] = v3
			indices[#indices+1] = c
			indices[#indices+1] = b
			
			indices[#indices+1] = a
			indices[#indices+1] = b
			indices[#indices+1] = c
			
			table.remove(indices, i)
			table.remove(indices, i - 1)
			table.remove(indices, i - 2)
		end
	end
	
	-- normalize
	for i = 1, #verts do
		verts[i] = verts[i].Unit
	end
	
	return verts
end
-- declarations



local sDied = newSound("")
local sFallingDown = newSound("")
local sFreeFalling = newSound("")
local sGettingUp = newSound("")
local sJumping = newSound("")
local sRunning = newSound("")
sRunning.Looped = true

local Figure = script.Parent
local Head = waitForChild(Figure, "Head")
local Humanoid = waitForChild(Figure, "Humanoid")
---- []


Body.DescendantAdded:Connect(function(descend)
	
	spawn(function()
		if descend:IsA("Tool") then
			TurnCharacterToMouse = true
		end
	end)
	
end)
Body.DescendantRemoving:Connect(function(descend)
	
	spawn(function()
		if descend:IsA("Tool") then
			TurnCharacterToMouse = false
		end
	end)
	
end)
--[[Engine]]


	--Torque Curve
	Tune.Horsepower		= 370		--	[TORQUE CURVE VISUAL]
	Tune.IdleRPM		= 700		--		https://www.desmos.com/calculator/2uo3hqwdhf
	Tune.PeakRPM		= 6000		--		Use sliders to manipulate values
	Tune.Redline		= 6700		--		Copy and paste slider values into the respective tune values
	Tune.EqPoint		= 5500
	Tune.PeakSharpness	= 7.5
	Tune.CurveMult		= 0.16
	
	--Incline Compensation
	Tune.InclineComp	= 4.7			-- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
	
	--Misc
	Tune.RevAccel		= 150		-- RPM acceleration when clutch is off
	Tune.RevDecay		= 75		-- RPM decay when clutch is off
	Tune.RevBounce		= 500		-- RPM kickback from redline
	Tune.IdleThrottle	= 3			-- Percent throttle at idle
	Tune.ClutchTol		= 500		-- Clutch engagement threshold (higher = faster response)
--Run


local ver=require(car["A-Chassis Tune"].README)
print("//INSPARE: AC6 Loaded - Build "..ver)

while wait() do 
	Steering()
	Engine()
	if _Tune.AutoFlip then Flip() end
	
	_IsOn = script.Parent.IsOn.Value
	_InControls = script.Parent.ControlsOpen.Value
	script.Parent.Values.Gear.Value = _CGear
	script.Parent.Values.RPM.Value = _RPM
	script.Parent.Values.Horsepower.Value = _HP
	script.Parent.Values.Torque.Value = _HP * 5250 / _RPM
	script.Parent.Values.TransmissionMode.Value = _TMode
	script.Parent.Values.Throttle.Value = _GThrot
	script.Parent.Values.Brake.Value = _GBrake
	script.Parent.Values.SteerC.Value = _GSteerC*(1-math.min(car.DriveSeat.Velocity.Magnitude/_Tune.SteerDecay,1-_Tune.MinSteer))
	script.Parent.Values.SteerT.Value = _GSteerT
	script.Parent.Values.PBrake.Value = _PBrake
	script.Parent.Values.TCS.Value = _TCS
	script.Parent.Values.TCSActive.Value = _TCSActive
	script.Parent.Values.Velocity.Value = car.DriveSeat.Velocity
	
	if _PGear~=_CGear then
		_PGear=_CGear
		car.DriveSeat.MaxSpeed = car.DriveSeat.Velocity.Magnitude*(_Tune.Redline/_RPM)
	end
end
---------------------------------------Function end here.


end


Tool.Enabled = true
function onActivated()

	if not Tool.Enabled then
		return
	end

	--Tool.Enabled = false

	local character = Tool.Parent;
	local humanoid = character.Humanoid
	if humanoid == nil then
		print("Humanoid not found")
		return 
	end

	local targetPos = humanoid.TargetPoint
	local lookAt = (targetPos - character.Head.Position).unit
	
	if (check()) then
	fire(lookAt)
	wait(0.1)
	onActivated()
	end
	return

	--Tool.Enabled = true
end


script.Parent.Activated:connect(onActivated)