Pinkstack/roblox-luau-corpus-text huggingface dataset:
--- Handles initial preparation of the game server-side.


return function (cmdr)
	local ReplicatedRoot, RemoteFunction, RemoteEvent

	local function Create (class, name, parent)
		local object = Instance.new(class)
		object.Name = name
		object.Parent = parent or ReplicatedRoot

		return object
	end

	ReplicatedRoot = script.Parent.CmdrClient
	ReplicatedRoot.Parent = ReplicatedStorage

	RemoteFunction = Create("RemoteFunction", "CmdrFunction")
	RemoteEvent = Create("RemoteEvent", "CmdrEvent")

	Create("Folder", "Commands")
	Create("Folder", "Types")

	script.Parent.Shared.Parent = ReplicatedRoot

	cmdr.ReplicatedRoot = ReplicatedRoot
	cmdr.RemoteFunction = RemoteFunction
	cmdr.RemoteEvent = RemoteEvent

	cmdr:RegisterTypesIn(script.Parent.BuiltInTypes)

	script.Parent.BuiltInTypes:Destroy()
	script.Parent.BuiltInCommands.Name = "Server commands"

	if StarterGui:FindFirstChild("Cmdr") == nil then
		CreateGui()
	end
end
--/////////////////////////////////////////////////////////--



local dZIndex 	 = 2
local dScrollBar = 4
local dBackground 	= Color3.new(31/255, 31/255, 31/255)
local dTransparency = 0
local dPixelSize 	= 0
local dBorder 		= Color3.new(27/255,42/255,53/255)
local dPosition 	= UDim2.new(0,5,0,5)
local dCanvasSize 	= UDim2.new(0, 0, 0, 0)
local dScrollImage 	= "http://roblox.com/asset?id=158348114"
local dTextColor = Color3.new(1,1,1)
local dSize 	 = UDim2.new(1,-10,1,-10)
local dFont 	 = "SourceSans"
local dTextSize  = 16
local dPlaceholderColor = Color3.fromRGB(178, 178, 178)
local MouseIcons = {
	Horizontal = "rbxassetid://1243146213";
	Vertical = "rbxassetid://1243145985";
	LeftCorner = "rbxassetid://1243145459";
	RightCorner = "rbxassetid://1243145350";
	TopRight = "rbxassetid://1243145459";
	TopLeft = "rbxassetid://1243145350";
}
--[=[
	@param orElseFn () -> Option
	@return Option
	If caller has a value, returns itself. Otherwise, returns the
	option generated by the `orElseFn` function.
]=]


function Option:OrElse(orElseFn)
	if self:IsSome() then
		return self
	else
		local result = orElseFn()
		Option.Assert(result)
		return result
	end
end
-- NOTE: Any number greater than 2^30 will make TextService:GetTextSize give invalid results


local MAX_BOUND = 10000

local function getTextHeight(text, font, fontSize, widthCap)
	local bounds = Vector2.new(widthCap, MAX_BOUND)
	local textSize = GetTextSize(text, fontSize, font, bounds)
	return textSize.Y
end

return getTextHeight
--[[
	Fixes the window, pressurizing the room if all windows are now fixed
]]


function Window:fix()
	self._state = Constants.State.Window.Normal

	local glass = self._model:FindFirstChild("Glass")
	glass.CanCollide = true
	glass.Material = Enum.Material.Glass
	glass.Color = Color3.fromRGB(116, 161, 255)
	glass.Transparency = 0.3

	local room = self._associatedRoom

	if room:allWindowsNormal() and room:isBreached() then
		room:ventRoom()
	end

	DestroyMarker:FireAllClients(glass)
end
-- Local Functions



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
	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()
	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
-- Waits for the child of the specified parent


local function WaitForChild(parent, childName)
	while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
	return parent[childName]
end


local Tool = script.Parent
local Handle = WaitForChild(Tool, 'Handle')
local Debounce = false

local TouchConnection


function OnTouched(hit)
	local humanoid = hit.Parent:findFirstChild('Humanoid')
	if Debounce == false then
		Debounce = true
		if humanoid then
			
		else
			Handle.Ting:Play()
		end
	end
	wait(0.5)
	Debounce = false
end


Tool.Equipped:connect(function()
	TouchConnection = Handle.Touched:connect(OnTouched)
end)

Tool.Unequipped:connect(function()
	if TouchConnection then
		TouchConnection:disconnect()
		TouchConnection = nil
	end
end)
--[[[Default Controls]]


	--Peripheral Deadzones
	Tune.Peripherals = {
		MSteerWidth				= 67		,	-- Mouse steering control width	(0 - 100% of screen width)
		MSteerDZone				= 0		,	-- 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				= nil				,
		ToggleABS				= nil					,
		ToggleTransMode			= nil					,
		ToggleMouseDrive		= nil					,
		
		--Primary Controls
		Throttle				= Enum.KeyCode.Up					,
		Brake					= Enum.KeyCode.Down					,
		SteerLeft				= Enum.KeyCode.Left					,
		SteerRight				= Enum.KeyCode.Right				,
		
		--Secondary Controls
		Throttle2				= Enum.KeyCode.W					,
		Brake2					= Enum.KeyCode.S					,
		SteerLeft2				= Enum.KeyCode.A					,
		SteerRight2				= Enum.KeyCode.D					,
		
		--Manual Transmission
		ShiftUp					= Enum.KeyCode.E					,
		ShiftDown				= Enum.KeyCode.Q					,
		Clutch					= Enum.KeyCode.LeftShift			,
		
		--Handbrake
		PBrake					= Enum.KeyCode.P					,
		
	--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			,
	}
--print("light loaded") 



local light = script.Parent 


while true do 

		light.Transparency = 0.9
	
		wait(5) 

		light.Transparency = 0.7

		wait(1) 
		
		light.Transparency = 0.5

		wait(1)
		
		light.Transparency = 0.3

		wait(1) 
		
		 light.Transparency = 0.1

		wait(2) 
		
		
		light.Transparency = 1

		wait(7) 
		
end
-- Movement mode standardized to Enum.ComputerCameraMovementMode values


function BaseCamera:SetCameraMovementMode( cameraMovementMode )
	self.cameraMovementMode = cameraMovementMode
end

function BaseCamera:GetCameraMovementMode()
	return self.cameraMovementMode
end

function BaseCamera:SetIsMouseLocked(mouseLocked)
	self.inMouseLockedMode = mouseLocked
	self:UpdateMouseBehavior()
end

function BaseCamera:GetIsMouseLocked()
	return self.inMouseLockedMode
end

function BaseCamera:SetMouseLockOffset(offsetVector)
	self.mouseLockOffset = offsetVector
end

function BaseCamera:GetMouseLockOffset()
	return self.mouseLockOffset
end

function BaseCamera:InFirstPerson()
	return self.inFirstPerson
end

function BaseCamera:EnterFirstPerson()
	-- Overridden in ClassicCamera, the only module which supports FirstPerson
end

function BaseCamera:LeaveFirstPerson()
	-- Overridden in ClassicCamera, the only module which supports FirstPerson
end
--[=[
	Promises a Roblox datastore object with the name and scope. Generally only fails
	when you haven't published the place.
	@param name string
	@param scope string
	@return Promise<DataStore>
]=]


function DataStorePromises.promiseDataStore(name, scope)
	assert(type(name) == "string", "Bad name")
	assert(type(scope) == "string", "Bad scope")

	return Promise.new(function(resolve, reject)
		local result = nil
		local ok, err = pcall(function()
			result = DataStoreService:GetDataStore(name, scope)
		end)
		if not ok then
			return reject(err)
		end
		return resolve(result)
	end)

end
--Service


local RunService = game:GetService("RunService")

return function(obj, text, duration)
    local length = #text 
    local interval = duration / length 

    local con, lastUpdate, currentPos = nil, time(), 1
    con = RunService.RenderStepped:Connect(function()
        if time() - lastUpdate > interval then
            currentPos += 1
            obj.Text = string.sub(text, 1, currentPos)
            lastUpdate = time()

            if currentPos == length then
                con:Disconnect()
            end 
        end 
    end)
end
------------------------------------------------------------------------------------------------------------



function configureAnimationSetOld(name, fileList)
	if animTable[name] ~= nil then
		for _, connection in pairs(animTable[name].connections) do
			connection:disconnect()
		end
	end
	animTable[name] = {}
	animTable[name].count = 0
	animTable[name].totalWeight = 0	
	animTable[name].connections = {}

	local allowCustomAnimations = true
	local AllowDisableCustomAnimsUserFlag = false

	local success, msg = pcall(function()
		AllowDisableCustomAnimsUserFlag = UserSettings():IsUserFeatureEnabled("UserAllowDisableCustomAnims2")
	end)

	if AllowDisableCustomAnimsUserFlag then
		local success, msg = pcall(function() allowCustomAnimations = game:GetService("StarterPlayer").AllowCustomAnimations end)
		if not success then
			allowCustomAnimations = true
		end
	end

	-- check for config values
	local config = script:FindFirstChild(name)
	if (allowCustomAnimations and config ~= nil) then
		table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end))
		table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end))
		local idx = 1
		for _, childPart in pairs(config:GetChildren()) do
			if childPart:IsA("Animation") then
				table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end))
				animTable[name][idx] = {}
				animTable[name][idx].anim = childPart
				local weightObject = childPart:FindFirstChild("Weight")
				if weightObject == nil then
					animTable[name][idx].weight = 1
				else
					animTable[name][idx].weight = weightObject.Value
				end
				animTable[name].count = animTable[name].count + 1
				animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
				idx = idx + 1
			end
		end
	end

	-- fallback to defaults
	if animTable[name].count <= 0 then
		for idx, anim in pairs(fileList) do
			animTable[name][idx] = {}
			animTable[name][idx].anim = Instance.new("Animation")
			animTable[name][idx].anim.Name = name
			animTable[name][idx].anim.AnimationId = anim.id
			animTable[name][idx].weight = anim.weight
			animTable[name].count = animTable[name].count + 1
			animTable[name].totalWeight = animTable[name].totalWeight + anim.weight
			-- print(name .. " [" .. idx .. "] " .. anim.id .. " (" .. anim.weight .. ")")
		end
	end
	
	-- preload anims
	if PreloadAnimsUserFlag then
		for i, animType in pairs(animTable) do
			for idx = 1, animType.count, 1 do 
				Humanoid:LoadAnimation(animType[idx].anim)
			end
		end
	end
end
--[[while wait(2) do
	local t = tick()
	script.Parent.PingRemote:InvokeServer()
	local ping = ((tick() - t) / 2) * 1000 -- time it takes in milliseconds
	local txt = string.format("Ping : %dms", ping)
	if ping > 130 then
		txt = string.format("%s (Warning high ping)",txt)
	end
	txt = string.format("%s Server location: %s",txt, script.Parent.PingLocation.Value)
	script.Parent.Text = txt
end]]



while wait(2) do
	local t = tick()
	script.Parent.PingRemote:InvokeServer()
	local ping = ((tick() - t) / 2) * 1000 -- time it takes in milliseconds
	local txt = string.format("%d ms", ping * 2)
	script.Parent.Text = txt
end
-- Main enemy loop


function Enemy:start()
	coroutine.wrap(function()
		self._active = true
		while(self._active) do
			self:_update()
			wait(UPDATE_TIME_INTERVAL)
		end
	end)()
end

function Enemy:stop()
	self._active = false
	self._model.Humanoid.WalkSpeed = 0
end

function Enemy:_destroy()
	self._model:Destroy()
end

function Enemy:_onTouch(otherPart)
	if self._active and CollectionService:HasTag(otherPart, "Platform") then
		hitPlatformEvent:Fire()
		self:stop()
		self:_destroy()
	end
end

return Enemy
-- << COMMANDS >>


local module = {
	
	-----------------------------------
	{
	Name = "votekick";
	Aliases	= {};
	Prefixes = {settings.Prefix};
	Rank = 2;
	RankLock = false;
	Loopable = false;
	Tags = {};
	Description = "votekick players! ";
	Contributors = {};
	--
	Args = {};
	Function = function(speaker, args)
		
	end;
	UnFunction = function(speaker, args)
		
	end;
	--
	};
	
	
	
	
	-----------------------------------
	{
	Name = "";
	Aliases	= {};
	Prefixes = {settings.Prefix};
	Rank = 1;
	RankLock = false;
	Loopable = false;
	Tags = {};
	Description = "";
	Contributors = {};
	--
	Args = {};
	--[[
	ClientCommand = true;
	FireAllClients = true;
	BlockWhenPunished = true;
	PreFunction = function(speaker, args)
		
	end;
	Function = function(speaker, args)
		wait(1)
	end;
	--]]
	--
	};
	
	
	
	
	-----------------------------------
	
};



return module
--							else print("Didn't hit Target")


							end
							if makeRays then
								makeRay(CFrame.new(origPos, position)
									* CFrame.new(0, 0, -distance/2), Vector3.new(0.2, 0.2, distance))
							end
						end
					end
				end
			end
		end
		round:remove()
		break
	end
	wait()
end
if round then
	round:remove()
end
script:remove()
-- Members --


	elseif (itemType == 'Property') then
		table.insert(Classes[item.Class].Properties, item)
	elseif (itemType == 'Function') then
		table.insert(Classes[item.Class].Functions, item)
	elseif (itemType == 'YieldFunction') then
		table.insert(Classes[item.Class].YieldFunctions, item)
	elseif (itemType == 'Event') then
		table.insert(Classes[item.Class].Events, item)
	elseif (itemType == 'Callback') then
		table.insert(Classes[item.Class].Callbacks, item)
--[[ Utility Functions ]]

--
local function IsFinite(num)
	return num == num and num ~= 1/0 and num ~= -1/0
end

local function IsFiniteVector3(vec3)
	return IsFinite(vec3.x) and IsFinite(vec3.y) and IsFinite(vec3.z)
end

local movementUpdateEvent = Instance.new("BindableEvent")
movementUpdateEvent.Name = "MovementUpdate"
movementUpdateEvent.Parent = script

coroutine.wrap(function()
	local PathDisplayModule = script.Parent:WaitForChild("PathDisplay")
	if PathDisplayModule then
		PathDisplay = require(PathDisplayModule)
	end
end)()
--Precalculated paths


local t,f,n=true,false,{}
local r={
[58]={{36,37,35,39,41,30,56,58},t},
[49]={{36,33,32,31,29,28,44,45,49},t},
[16]={n,f},
[19]={{36,37,35,39,41,30,56,58,20,19},t},
[59]={{36,37,35,39,41,59},t},
[63]={{36,37,35,39,41,30,56,58,23,62,63},t},
[34]={{36,37,35,34},t},
[21]={{36,37,35,39,41,30,56,58,20,21},t},
[48]={{36,33,32,31,29,28,44,45,49,48},t},
[27]={{36,33,32,31,29,28,27},t},
[14]={n,f},
[31]={{36,33,32,31},t},
[56]={{36,37,35,39,41,30,56},t},
[29]={{36,33,32,31,29},t},
[13]={n,f},
[47]={{36,33,32,31,29,28,44,45,49,48,47},t},
[12]={n,f},
[45]={{36,33,32,31,29,28,44,45},t},
[57]={{36,37,35,39,41,30,56,57},t},
[36]={{36},t},
[25]={{36,33,32,31,29,28,27,26,25},t},
[71]={{36,37,35,39,41,59,61,71},t},
[20]={{36,37,35,39,41,30,56,58,20},t},
[60]={{36,37,35,39,41,60},t},
[8]={n,f},
[4]={n,f},
[75]={{36,37,35,39,41,59,61,71,72,76,73,75},t},
[22]={{36,37,35,39,41,30,56,58,20,21,22},t},
[74]={{36,37,35,39,41,59,61,71,72,76,73,74},t},
[62]={{36,37,35,39,41,30,56,58,23,62},t},
[1]={n,f},
[6]={n,f},
[11]={n,f},
[15]={n,f},
[37]={{36,37},t},
[2]={n,f},
[35]={{36,37,35},t},
[53]={{36,33,32,31,29,28,44,45,49,48,47,52,53},t},
[73]={{36,37,35,39,41,59,61,71,72,76,73},t},
[72]={{36,37,35,39,41,59,61,71,72},t},
[33]={{36,33},t},
[69]={{36,37,35,39,41,60,69},t},
[65]={{36,37,35,39,41,30,56,58,20,19,66,64,65},t},
[26]={{36,33,32,31,29,28,27,26},t},
[68]={{36,37,35,39,41,30,56,58,20,19,66,64,67,68},t},
[76]={{36,37,35,39,41,59,61,71,72,76},t},
[50]={{36,33,32,31,29,28,44,45,49,48,47,50},t},
[66]={{36,37,35,39,41,30,56,58,20,19,66},t},
[10]={n,f},
[24]={{36,33,32,31,29,28,27,26,25,24},t},
[23]={{36,37,35,39,41,30,56,58,23},t},
[44]={{36,33,32,31,29,28,44},t},
[39]={{36,37,35,39},t},
[32]={{36,33,32},t},
[3]={n,f},
[30]={{36,37,35,39,41,30},t},
[51]={{36,33,32,31,29,28,44,45,49,48,47,50,51},t},
[18]={n,f},
[67]={{36,37,35,39,41,30,56,58,20,19,66,64,67},t},
[61]={{36,37,35,39,41,59,61},t},
[55]={{36,33,32,31,29,28,44,45,49,48,47,52,53,54,55},t},
[46]={{36,33,32,31,29,28,44,45,49,48,47,46},t},
[42]={{36,37,35,38,42},t},
[40]={{36,37,35,40},t},
[52]={{36,33,32,31,29,28,44,45,49,48,47,52},t},
[54]={{36,33,32,31,29,28,44,45,49,48,47,52,53,54},t},
[43]={n,f},
[7]={n,f},
[9]={n,f},
[41]={{36,37,35,39,41},t},
[17]={n,f},
[38]={{36,37,35,38},t},
[28]={{36,33,32,31,29,28},t},
[5]={n,f},
[64]={{36,37,35,39,41,30,56,58,20,19,66,64},t},
}
return r
--[[

   _____ _                 _                  _           _       
  / ____(_)               | |        /\      | |         (_)      
 | (___  _ _ __ ___  _ __ | | ___   /  \   __| |_ __ ___  _ _ __  
  \___ \| | '_ ` _ \| '_ \| |/ _ \ / /\ \ / _` | '_ ` _ \| | '_ \ 
  ____) | | | | | | | |_) | |  __// ____ \ (_| | | | | | | | | | |
 |_____/|_|_| |_| |_| .__/|_|\___/_/    \_\__,_|_| |_| |_|_|_| |_|
                    | |                                           
                    |_|                                           

--]]



local Config = {
	DebugMode = false; -- Loads the MainModule (parented to the Loader) rather than the live asset.
	Asset = 5300444087;
	Settings = require(script.Parent.Parent:WaitForChild("Settings"))
}

if not _G.SimpleAdminLoaded then
	script.Parent.Parent.Parent = game:GetService("ServerScriptService")
	
	_G.SimpleAdmin = script.Parent.Parent
	local Start = tick()
	local Module = require((Config.DebugMode) and script:WaitForChild("MainModule") or Config.Asset)
	
	if Module(Config.Settings) then
		_G.SimpleAdminLoaded = true;
		warn("SimpleAdmin Loaded! (" .. tick() - Start .. " seconds)")
	else
		warn("Something went wrong while loading SimpleAdmin.")	
	end
else
	local Model = script.Parent.Parent.Parent.Parent
	if Model:IsA("Model") and Model.Name == "SimpleAdmin" then
		Model:Destroy()
	end
end
--[[
    Turns brake lights on or off depending on the status
]]


function VehicleLightsComponent:updateStatus(statusesChanged)
	if statusesChanged.Braking ~= nil then
		local brakeLightsOn = statusesChanged.Braking
		if brakeLightsOn ~= self.state.brakeLights then
			self.state.brakeLights = brakeLightsOn
			self:toggleLights(self.brakeLights, brakeLightsOn)
		end
	end
end

return VehicleLightsComponent
--	HUB.Default:TweenPosition(UDim2.new(0, 0, mode,3),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,.4,true)


end

swap()
 
mouse.KeyDown:connect(function (key)
    key = string.lower(key)
	if key == "k" then --Camera controls
        if cam == ("car") then
			Camera.CameraSubject = player.Character.Humanoid
			Camera.CameraType = ("Custom")
			cam = ("freeplr")
			Camera.FieldOfView = 70
		elseif cam == ("freeplr") then
			Camera.CameraSubject = player.Character.Humanoid
			Camera.CameraType = ("Attach")
			cam = ("lockplr")
        elseif cam == ("lockplr") then
			Camera.CameraSubject = carSeat
			Camera.CameraType = ("Custom")
			cam = ("car")
			Camera.FieldOfView = 70
        end
--[=[
	Taps into the observable and executes the onFire/onError/onComplete
	commands.

	https://rxjs-dev.firebaseapp.com/api/operators/tap

	@param onFire function?
	@param onError function?
	@param onComplete function?
	@return (source: Observable<T>) -> Observable<T>
]=]


function Rx.tap(onFire, onError, onComplete)
	assert(type(onFire) == "function" or onFire == nil, "Bad onFire")
	assert(type(onError) == "function" or onError == nil, "Bad onError")
	assert(type(onComplete) == "function" or onComplete == nil, "Bad onComplete")

	return function(source)
		assert(Observable.isObservable(source), "Bad observable")

		return Observable.new(function(sub)
			return source:Subscribe(
				function(...)
					if onFire then
						onFire(...)
					end
					if sub:IsPending() then
						sub:Fire(...)
					end
				end,
				function(...)
					if onError then
						onError(...)
					end
					sub:Error(...)
				end,
				function(...)
					if onComplete then
						onComplete(...)
					end
					sub:Complete(...)
				end)
		end)
	end
end
--// # key, meme


mouse.KeyDown:connect(function(key)
	if key=="k" then 
		if veh.Lightbar.middle.meme.IsPlaying == true then
		veh.Lightbar.middle.Wail:Stop()
		veh.Lightbar.middle.meme:Stop()
		veh.Lightbar.middle.Priority:Stop()
		script.Parent.Parent.Sirens.meme.BackgroundColor3 = Color3.fromRGB(62, 62, 62)
		else
		veh.Lightbar.middle.Wail:Stop()
		veh.Lightbar.middle.meme:Play()
		veh.Lightbar.middle.Priority:Stop()
		script.Parent.Parent.Sirens.meme.BackgroundColor3 = Color3.fromRGB(215, 135, 110)
		script.Parent.Parent.Sirens.Wail.BackgroundColor3 = Color3.fromRGB(62, 62, 62)
		script.Parent.Parent.Sirens.Priority.BackgroundColor3 = Color3.fromRGB(62, 62, 62)
		end
	end
end)
---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- 



runService.RenderStepped:connect(function()
	 
	if running then
		updatechar()
		
		CamPos = CamPos + (TargetCamPos - CamPos) *0.28 
		AngleX = AngleX + (TargetAngleX - AngleX) *0.35 
		local dist = TargetAngleY - AngleY 
		dist = math.abs(dist) > 180 and dist - (dist / math.abs(dist)) * 360 or dist 
		AngleY = (AngleY + dist *0.35) %360
		cam.CameraType = Enum.CameraType.Scriptable
		
		cam.CoordinateFrame = CFrame.new(head.Position) 
		* CFrame.Angles(0,math.rad(AngleY),0) 
		* CFrame.Angles(math.rad(AngleX),0,0)
		* CFrame.new(0,0.8,0) -- offset
		
		humanoidpart.CFrame=CFrame.new(humanoidpart.Position)*CFrame.Angles(0,math.rad(AngleY),0)
		character.Humanoid.AutoRotate = false
		else game:GetService("UserInputService").MouseBehavior = Enum.MouseBehavior.Default; character.Humanoid.AutoRotate = true
	end

	if (cam.Focus.p-cam.CoordinateFrame.p).magnitude < 1 then
		running = false
	else
		running = true
		if freemouse == true then
			game:GetService("UserInputService").MouseBehavior = Enum.MouseBehavior.Default
		else
			game:GetService("UserInputService").MouseBehavior = Enum.MouseBehavior.LockCenter
		end
	end
	
	if not CanToggleMouse.allowed then
		freemouse = false
	end
	
	cam.FieldOfView = FieldOfView

end)
--throttle.Value = TCount 



if carSeat.Throttle == 1 then
if autoF - 1 > autoR or clutch.Clutch.Value ~= 1 then
	TCount = 1 
	else
	if TCount >= 1 then
		TCount = 1
	else
		if speed > 50 then
		TCount = TCount + 0.167
		
		elseif speed < 20 then
		TCount = TCount + 0.3334
		
			else
		TCount = TCount + 0.02
		end
	end
	
	end
else
	if TCount <= 0 then
		TCount = 0
	else
		TCount = 0
	end
end

if currentgear.Value ~= 1 then tlR = 0
	if clutch.Clutch.Value ~= 1 then
		if throttle.Value ~= 0 then
			if engine.Value > redline.Value * (1-clutch.Clutch.Value) then --------------?? WE DONT NEED A 'FOR' IN THE CLUTCH CODE
				engine.Value = engine.Value - 300
				else
				engine.Value = engine.Value + (((600+decay.Value) * throttle.Value) - decay.Value) 
			end else engine.Value = engine.Value - decay.Value
		end
		rpm.Value = engine.Value
	else
		engine.Value = rpm.Value
	end
else
	tlR = tlR + 0.05
	if tlR > 20 then
		script.Parent.Functions.Engine.Value = false
		first = 0.333
	end
	engine.Value = engine.Value + (((600+decay.Value) * first) - decay.Value)
	if engine.Value > idle.Value*2 then
		first = 0 
	end
		--engine.Value = (idle.Value-decay.Value)
		
end

drive = "x"