Pinkstack/roblox-luau-corpus-text huggingface dataset:
-- << Functions >> --



UserInputService.MouseIconEnabled = false

function lerp(a, b, c)
	return a + (b - a) * c
end

bobbing = game:GetService("RunService").RenderStepped:Connect(function(deltaTime)
	deltaTime = deltaTime * 60
	if Humanoid.Health <= 0 then
		bobbing:Disconnect()
		return
	end
	local rootMagnitude = Humanoid.RootPart and Vector3.new(Humanoid.RootPart.Velocity.X, 0, Humanoid.RootPart.Velocity.Z).Magnitude or 0
	local calcRootMagnitude = math.min(rootMagnitude, 50)
	if deltaTime > 3 then
		func1 = 0
		func2 = 0
	else
		func1 = lerp(func1, math.cos(tick() * 3 * math.random(60, 100)) * (math.random(60, 100) / 200) * deltaTime, 0.05 * deltaTime)
		func2 = lerp(func2, math.cos(tick() * 3 * math.random(5, 100)) * (math.random(2, 100) / 200) * deltaTime, 0.05 * deltaTime)
	end
	Camera.CFrame = Camera.CFrame * (CFrame.fromEulerAnglesXYZ(0, 0, math.rad(func3)) * CFrame.fromEulerAnglesXYZ(math.rad(func4 * deltaTime), math.rad(val * deltaTime), val2) * CFrame.Angles(0, 0, math.rad(func4 * deltaTime * (calcRootMagnitude / 5))) * CFrame.fromEulerAnglesXYZ(math.rad(func1), math.rad(func2), math.rad(func2 * 10)))
	val2 = math.clamp(lerp(val2, -Camera.CFrame:VectorToObjectSpace((Humanoid.RootPart and Humanoid.RootPart.Velocity or Vector3.new()) / math.max(Humanoid.WalkSpeed, 0.01)).X * 0.08, 0.1 * deltaTime), -0.35, 0.2)
	func3 = lerp(func3, math.clamp(UserInputService:GetMouseDelta().X, -5, 5), 0.25 * deltaTime)
	func4 = lerp(func4, math.sin(tick() * int) / 5 * math.min(1, int2 / 10), 0.25 * deltaTime)
	if rootMagnitude > 1 then
		val = lerp(val, math.cos(tick() * 0.5 * math.floor(int)) * (int / 200), 0.25 * deltaTime)
	else
		val = lerp(val, 0, 0.05 * deltaTime)
	end
	if rootMagnitude > 12 then
		int = 25
		int2 = 22
	elseif rootMagnitude > 0.1 then
		int = 12
		int2 = 14
	else
		int2 = 0
	end
	Player.CameraMaxZoomDistance = 0.5
	Player.CameraMinZoomDistance = 0.5
	vect3 = lerp(vect3, Camera.CFrame.LookVector, 0.125 * deltaTime)
end)
-- dont edit my script prea loser



game:GetService('RunService'):IsRunning()
task.wait(2)
warn('Loaded!')
Instance.new('Folder',workspace).Name = 'Container'
local C = workspace:FindFirstChild('Container')

game:GetService('ReplicatedStorage').MapGenerate.OnServerEvent:Connect(function(t,id)
	if #C:GetChildren() ~= 0 then C:ClearAllChildren() end
	local MapID = (math.floor((tonumber(id))))

	local Materials = {
		'SmoothPlastic',
		'Neon',
		'Ice',
		'Foil',
		'Sand',
		'Wood',
		'Brick',
		'Grass',
		'Glass',
		'Metal',
		'Slate',
		'Fabric',
		'Marble',
		'Pebble',
		'Granite',
		'Plastic',
		'Concrete',
		'ForceField',
		'WoodPlanks',
		'Cobblestone',
		'DiamondPlate'
	}

	game:GetService('ReplicatedStorage').SeedEvent:FireAllClients(MapID)

	local function GetNumbers(x:string)
		local t = {}
		for i=1,#x do
			if i~=1 then 
				t[#t+1] = x:sub(i,i)
			end
		end
		return x:split('')[1]..'.'..table.concat(t,'')
	end


	local r,f,x = 20, 1,100

	for i = 0,x do
		task.wait()
		for v = 0,x do
			local p = Instance.new('Part')
			p.Parent = C
			p.Size = Vector3.new(1,1,1)
			p.Anchored = true
			p.Color = Color3.fromRGB((math.random(1,255)),(math.random(1,255)),(math.random(1,255)))
			p.Material = Enum.Material[Materials[math.random(#Materials)]]
			--p.Color = Color3.fromRGB(0, 0, 255)
			p.Position = Vector3.new(
				i,
				(math.noise(
					i/r*f,
					v/r*f				
					))*((tonumber(GetNumbers(tostring(MapID))))*(10)),
				v
			)
		end
	end

	warn('All Parts:',#C:GetChildren(),'Parts')
end)
---[[ Message Settings ]]


module.MaximumMessageLength = 500
module.DisallowedWhiteSpace = {"\n", "\r", "\t", "\v", "\f"}
module.ClickOnPlayerNameToWhisper = true
module.ClickOnChannelNameToSetMainChannel = true
module.BubbleChatMessageTypes = {ChatConstants.MessageTypeDefault, ChatConstants.MessageTypeWhisper}
--////////////////////////////// Include
--//////////////////////////////////////


local Chat = game:GetService("Chat")
local clientChatModules = Chat:WaitForChild("ClientChatModules")
local messageCreatorModules = clientChatModules:WaitForChild("MessageCreatorModules")
local messageCreatorUtil = require(messageCreatorModules:WaitForChild("Util"))
local modulesFolder = script.Parent
local ChatSettings = require(clientChatModules:WaitForChild("ChatSettings"))
local moduleObjectPool = require(modulesFolder:WaitForChild("ObjectPool"))
local MessageSender = require(modulesFolder:WaitForChild("MessageSender"))
--[[
	Assert that our expectation value is equal to another value within some
	inclusive limit.
]]


function Expectation:near(otherValue, limit)
	assert(type(self.value) == "number", "Expectation value must be a number to use 'near'")
	assert(type(otherValue) == "number", "otherValue must be a number")
	assert(type(limit) == "number" or limit == nil, "limit must be a number or nil")

	limit = limit or 1e-7

	local result = (math.abs(self.value - otherValue) <= limit) == self.successCondition

	local message = formatMessage(self.successCondition,
		("Expected value to be near %f (within %f) but got %f instead"):format(
			otherValue,
			limit,
			self.value
		),
		("Expected value to not be near %f (within %f) but got %f instead"):format(
			otherValue,
			limit,
			self.value
		)
	)

	assertLevel(result, message, 3)
	self:_resetModifiers()

	return self
end
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
---- Option Bindables



do
	local optionCallback = {
		Modifiable = function(value)
			for i = 1,#actionButtons do
				actionButtons[i].Obj.Visible = value and Option.Selectable
			end
			cancelReparentDrag()
		end;
		Selectable = function(value)
			for i = 1,#actionButtons do
				actionButtons[i].Obj.Visible = value and Option.Modifiable
			end
			cancelSelectDrag()
			Selection:Set({})
		end;
	}

	local bindSetOption = explorerPanel:FindFirstChild("SetOption")
	if not bindSetOption then
		bindSetOption = Create('BindableFunction',{Name = "SetOption"})
		bindSetOption.Parent = explorerPanel
	end

	bindSetOption.OnInvoke = function(optionName,value)
		if optionCallback[optionName] then
			Option[optionName] = value
			optionCallback[optionName](value)
		end
	end

	local bindGetOption = explorerPanel:FindFirstChild("GetOption")
	if not bindGetOption then
		bindGetOption = Create('BindableFunction',{Name = "GetOption"})
		bindGetOption.Parent = explorerPanel
	end

	bindGetOption.OnInvoke = function(optionName)
		if optionName then
			return Option[optionName]
		else
			local options = {}
			for k,v in pairs(Option) do
				options[k] = v
			end
			return options
		end
	end
end

function SelectionVar()
	return Selection
end

Input.InputBegan:connect(function(key)
	if key.KeyCode == Enum.KeyCode.LeftControl then
		HoldingCtrl = true
	end
	if key.KeyCode == Enum.KeyCode.LeftShift then
		HoldingShift = true
	end
end)

Input.InputEnded:connect(function(key)
	if key.KeyCode == Enum.KeyCode.LeftControl then
		HoldingCtrl = false
	end
	if key.KeyCode == Enum.KeyCode.LeftShift then
		HoldingShift = false
	end
end)

while RbxApi == nil do
	RbxApi = GetApiRemote:Invoke()
	wait()
end

explorerFilter.Changed:connect(function(prop)
	if prop == "Text" then		
		Selection.Finding = true
		rawUpdateList()
	end
end)

explorerFilter.FocusLost:connect(function()	
	if explorerFilter.Text == "" then
		if Selection.Found[1] then
			scrollBar:ScrollTo(NodeLookup[Selection.Found[1]].Index)
		end

		Selection.Finding = false
		Selection.Found = {}
	end
end)

CurrentInsertObjectWindow = CreateInsertObjectMenu(
	GetClasses(),
	"",
	false,
	function(option)
		CurrentInsertObjectWindow.Visible = false
		local list = SelectionVar():Get()
		for i = 1,#list do
			RemoteEvent:InvokeServer("InstanceNew", option, list[i])
		end
		DestroyRightClick()
	end
)
--



function Portal:AddToWorld(item)
	item.Parent = self.ViewportFrame
end

function Portal:ClipModel(model)
	local cf, size = self:GetSurfaceInfo()
	local descendants = model:GetDescendants()
	for i = 1, #descendants do
		local part = descendants[i]
		if (part:IsA("BasePart")) then
			local corners = getCorners(part)
			table.insert(corners, 1, part.Position)
			
			local pass = false
			for j = 1, #corners do
				if (cf:PointToObjectSpace(corners[j]).z <= 0) then
					pass = true
					break
				end
			end
			
			if (not pass) then
				part:Destroy()
			end
		end
	end
	return model
end

function Portal:GetPart()
	return self.SurfaceGUI.Adornee
end

function Portal:GetSurfaceInfo()
	local part = self.SurfaceGUI.Adornee
	local partCF, partSize = part.CFrame, part.Size
	
	local back = -Vector3.FromNormalId(self.SurfaceGUI.Face)
	local axis = (math.abs(back.y) == 1) and Vector3.new(back.y, 0, 0) or UP
	local right = CFrame.fromAxisAngle(axis, PI2) * back
	local top = back:Cross(right).Unit
	
	local cf = partCF * CFrame.fromMatrix(-back*partSize/2, right, top, back)
	local size = Vector3.new((partSize * right).Magnitude, (partSize * top).Magnitude, (partSize * back).Magnitude)

	return cf, size
end

function Portal:RenderFrame(camCF, surfaceCF, surfaceSize)
	local vpf = self.ViewportFrame
	local surfaceGUI = self.SurfaceGUI
	local camera = game.Workspace.CurrentCamera
	local nCamera = self.Camera
	
	local camCF = camCF or camera.CFrame
	if not (surfaceCF and surfaceSize) then 
		surfaceCF, surfaceSize = self:GetSurfaceInfo()
	end
	
	local rPoint = surfaceCF:PointToObjectSpace(camCF.p)
	local sX, sY = rPoint.x / surfaceSize.x, rPoint.y / surfaceSize.y
	
	local scale = 1 + math.max(
		surfaceSize.y / surfaceSize.x, 
		surfaceSize.x / surfaceSize.y, 
		math.max(math.abs(sX), math.abs(sY))*2
	)
	
	local height = surfaceSize.y/2
	local rDist = (camCF.p - surfaceCF.p):Dot(surfaceCF.LookVector)
	local newFov = 2*math.atan2(height, rDist)
	local clampedFov = math.clamp(math.deg(newFov), 1, 120)
	local pDist = height / math.tan(math.rad(clampedFov)/2)
	local adjust = rDist / pDist
	
	local factor = (newFov > FOV120 and adjust or 1) / scale
	local scaleCF = CFrame.new(0, 0, 0, factor, 0, 0, 0, factor, 0, 0, 0, 1)
	
	vpf.Position = UDim2.new(vpf.AnchorPoint.x - sX, 0, vpf.AnchorPoint.y - sY, 0)
	vpf.Size = UDim2.new(scale, 0, scale, 0)
	vpf.BackgroundColor3 = surfaceGUI.Adornee.Color
	
	local viewportSizeY = camera.ViewportSize.y
	surfaceGUI.CanvasSize = Vector2.new(viewportSizeY*(surfaceSize.x/surfaceSize.y), viewportSizeY)
	
	nCamera.FieldOfView = clampedFov
	nCamera.CFrame = CFrame.new(camCF.p) * (surfaceCF - surfaceCF.p) * CFrame.Angles(0, math.pi, 0) * scaleCF
end
----------------------------------------------------------------------------------------------------
-------------------=[ PROJETIL ]=-------------------------------------------------------------------
----------------------------------------------------------------------------------------------------


	,Distance = 500
	,BDrop = .25
	,BSpeed = 2500

	,SuppressMaxDistance = 25	--- Studs
	,SuppressTime = 10			--- Seconds

	,BulletWhiz = true
	,BWEmitter = 25
	,BWMaxDistance = 200
	
	,BulletFlare = false
	,BulletFlareColor = Color3.fromRGB(255,255,255)

	,Tracer = false
	,TracerColor = Color3.fromRGB(255,255,255)
	,TracerLightEmission = 1
	,TracerLightInfluence = 0
	,TracerLifeTime = .2
	,TracerWidth = .1
	,RandomTracer = false
	,TracerEveryXShots = 5
	,TracerChance = 100
	
	,BulletLight = false
	,BulletLightBrightness = 1
	,BulletLightColor = Color3.fromRGB(255,255,255)
	,BulletLightRange = 10

	,ExplosiveHit = false
	,ExPressure = 500
	,ExpRadius = 25
	,DestroyJointRadiusPercent = 0	--- Between 0 & 1
	,ExplosionDamage = 100

	,LauncherDamage = 100
	,LauncherRadius = 25
	,LauncherPressure = 500
	,LauncherDestroyJointRadiusPercent = 0
-- 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 Animations = {}
local MyHumanoid
local MyCharacter


local StartAnim = WaitForChild(script, 'Start')
local StopAnim = WaitForChild(script, 'Stop')


function PlayAnimation(animationName, speed)
	speed = speed or 1
	if Animations[animationName] then
		Animations[animationName]:Play(0.1, 1, speed)
	else
		print("Can't find animation:" , animationName)
	end
end

function StopAnimation(animationName)
	if Animations[animationName] then
		Animations[animationName]:Stop()
	end
end

function ConnectAnimationToValueChange(valueName, animationName)
	return WaitForChild(Tool, valueName).Changed:connect(
		function (value)
				PlayAnimation(animationName)
		end)
end

function LoadAnimation(animationObject)
	if MyHumanoid then
		Animations[animationObject.Name] = MyHumanoid:LoadAnimation(animationObject)
	else
		print("Tried to load an anim without a humanoid")
	end
end


function OnEquipped(mouse)
	MyCharacter = Tool.Parent
	MyHumanoid = WaitForChild(MyCharacter, 'Humanoid')
	
	Tool.ChildAdded:connect(function (child) if child:IsA('Animation') then LoadAnimation(animationObject) end end)
	for _, child in pairs(Tool:GetChildren()) do
		if child:IsA('Animation') then
			LoadAnimation(child)
		end
	end
end

function OnUnequipped()
	for name, animTrack in pairs(Animations) do
		StopAnimation(name);
	end
end

StartAnim.OnInvoke = PlayAnimation
StopAnim.OnInvoke = StopAnimation

Tool.Equipped:connect(OnEquipped)
Tool.Unequipped:connect(OnUnequipped)
-- this is the animation script put your animation id in the animation


tool = script.Parent
local sword = true
tool.Activated:Connect(function()
	if sword == false then return end
	sword = false
	local char = tool.Parent
	local hum = char.Humanoid
	
	local anim = hum:LoadAnimation(script.Parent.Animation)
	anim:Play()
	wait(1)
	sword = true
end)
--[[ DOCUMENTATION
- Will work in tools. If ran more than once it will not create more than one weld.  This is especially useful for tools that are dropped and then picked up again.
- Will work in PBS servers
- Will work as long as it starts out with the part anchored
- Stores the relative CFrame as a CFrame value
- Takes careful measure to reduce lag by not having a joint set off or affected by the parts offset from origin
- Utilizes a recursive algorith to find all parts in the model
- Will reweld on script reparent if the script is initially parented to a tool.
- Welds as fast as possible
]]
-- we could have missed the onEquip event on script start


if Board.Controller and not Controller then

	onEquip(Board.ControllingHumanoid, Board.Controller)

end

function cruiseModify()
	-- change the pitch and volume of the cruising sound

	local v = Board.Velocity.magnitude

	if (v < 1) then
		Board.CruiseLoop.Volume = 0
		return
	end

	local lowPitch = .85
	local topPitch = 1.1

	local lowV = .1
	local topV = 1

	Board.CruiseLoop.Volume = math.min(((topV - lowV) * (v / topSpeed)) + lowV, 1)
	Board.CruiseLoop.Pitch = ((topPitch - lowPitch) * (v / topSpeed)) + lowPitch

	
end

function breakModifyAndPlay()
	local v = Board.Velocity.magnitude
	
	local slowest = 10
	if (v < slowest) then return end

	local lowV = .05
	local topV = .8

	Board.BoardStop.Volume = math.min(((topV - lowV) * (v / (topSpeed - slowest))) + lowV, 1)
	Board.BoardStop:Play()
end

while true do
	cruiseModify()
	wait(.1)
end
--Right.InputChanged:Connect(RightTurn)



local function TouchThrottle(input, GPE)
	if input.UserInputState == Enum.UserInputState.Begin and _IsOn then
		_GThrot = 1
	else
		_GThrot = _Tune.IdleThrottle/100
	end
end
Gas.InputBegan:Connect(TouchThrottle)
Gas.InputEnded:Connect(TouchThrottle)
-- Function to bind to Unequip event


local function unequip()
	if connection then connection:disconnect() end
	contextActionService:UnbindAction("Reload")
	game.ReplicatedStorage.ROBLOX_PistolUnequipEvent:FireServer()
	mouse.Icon = oldIcon
	neck.C0 = oldNeckC0
	shoulder.C0 = oldShoulderC0
end
-- functions



function stopAllAnimations()
	local oldAnim = currentAnim

	-- return to idle if finishing an emote
	if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
		oldAnim = "idle"
	end

	currentAnim = ""
	currentAnimInstance = nil
	if (currentAnimKeyframeHandler ~= nil) then
		currentAnimKeyframeHandler:Disconnect()
	end

	if (currentAnimTrack ~= nil) then
		currentAnimTrack:Stop()
		currentAnimTrack:Destroy()
		currentAnimTrack = nil
	end
	return oldAnim
end

function setAnimationSpeed(speed)
	if speed ~= currentAnimSpeed then
		currentAnimSpeed = speed
		currentAnimTrack:AdjustSpeed(currentAnimSpeed)
	end
end

function keyFrameReachedFunc(frameName)
	if (frameName == "End") then

		local repeatAnim = currentAnim
		-- return to idle if finishing an emote
		if (emoteNames[repeatAnim] ~= nil and emoteNames[repeatAnim] == false) then
			repeatAnim = "idle"
		end
		
		local animSpeed = currentAnimSpeed
		playAnimation(repeatAnim, 0.0, Humanoid)
		setAnimationSpeed(animSpeed)
	end
end
--[[ The Module ]]

--
local BaseCharacterController = require(script.Parent:WaitForChild("BaseCharacterController"))
local DynamicThumbstick = setmetatable({}, BaseCharacterController)
DynamicThumbstick.__index = DynamicThumbstick

function DynamicThumbstick.new()
	local self = setmetatable(BaseCharacterController.new(), DynamicThumbstick)

	self.humanoid = nil

	self.tools = {}
	self.toolEquipped = nil

	self.revertAutoJumpEnabledToFalse = false

	self.moveTouchObject = nil
	self.moveTouchLockedIn = false
	self.moveTouchFirstChanged = false
	self.moveTouchStartPosition = nil

	self.startImage = nil
	self.endImage = nil
	self.middleImages = {}

	self.startImageFadeTween = nil
	self.endImageFadeTween = nil
	self.middleImageFadeTweens = {}

	self.isFirstTouch = true

	self.isFollowStick = false
	self.thumbstickFrame = nil

	self.onRenderSteppedConn = nil

	self.fadeInAndOutBalance = FADE_IN_OUT_BALANCE_DEFAULT
	self.fadeInAndOutHalfDuration = FADE_IN_OUT_HALF_DURATION_DEFAULT
	self.hasFadedBackgroundInPortrait = false
	self.hasFadedBackgroundInLandscape = false

	self.tweenInAlphaStart = nil
	self.tweenOutAlphaStart = nil

	-- If this module changes a player's humanoid's AutoJumpEnabled, it saves
	-- the previous state in this variable to revert to
	self.shouldRevertAutoJumpOnDisable = false

	return self
end
--[[Drivetrain]]

	
	Tune.Config			= "RWD"		--"FWD" , "RWD" , "AWD"
	
	--Differential Settings	
	Tune.FDiffSlipThres	= 50	-- 1 - 100%				(Max threshold of applying full lock determined by deviation from avg speed)
	Tune.FDiffLockThres	= 0		-- 0 - 100%				(0 - Bias toward slower wheel, 100 - Bias toward faster wheel)
	Tune.RDiffSlipThres	= 100	-- 1 - 100%
	Tune.RDiffLockThres	= 0		-- 0 - 100%
	Tune.CDiffSlipThres	= 1		-- 1 - 100%				[AWD Only]
	Tune.CDiffLockThres	= 0		-- 0 - 100%				[AWD Only]
	
	--Traction Control Settings
	Tune.TCSEnabled		= true	   -- Implements TCS
	Tune.TCSThreshold	= 10	       -- Slip speed allowed before TCS starts working (in SPS)
	Tune.TCSGradient	= 10	       -- Slip speed gradient between 0 to max reduction (in SPS)
	Tune.TCSLimit		= 20 	   -- Minimum amount of torque at max reduction (in percent)
-- just setting values here lol



local detectionrange = mySettings.DetectionRange.Value
local mag = fullMag
local bulletCopy = m4.Bullet:Clone()
local bulletCaseCopy = m4.BulletCase:Clone()
local bulletHoleCopy = m4.BulletHole:Clone()

bulletCopy.Parent = serverStorage
bulletCaseCopy.Parent = serverStorage
bulletHoleCopy.Parent = serverStorage

if m4.Bullet then
	m4.Bullet:Destroy()
end

if m4.BulletCase then
	m4.BulletCase:Destroy()
end

if m4.BulletHole then
	m4.BulletHole:Destroy()
end
--[[
	Exposes an interface to set global configuration values for a package.

	Configuration can only occur once, and should only be done by an application
	using this package, not a library.

	Any keys that aren't recognized will cause errors. Configuration is only
	intended for configuring the package itself, not extensions or libraries.

	Configuration is expected to be set immediately after loading the package. Setting
	configuration values after an application starts may produce unpredictable
	behavior.
]]



local Config = {}
--[[
	A common interface for accessing the values of state objects or constants.
]]



local xtypeof = require(script.Parent.Parent.ObjectUtility).xtypeof

local function unwrap<T>(item: T, useDependency: boolean?): T
	return if xtypeof(item) == "State" then (item :: any):get(useDependency) else (item :: T)
end

return unwrap
-- Takes an instance and overlays it on top of a parent. This is used for
-- overlaying a DevModule's DataModel-based layout on top of existing services.


local function overlay(instance: Instance, parent: Instance)
    for _, child in ipairs(instance:GetChildren()) do
        local existingChild = parent:FindFirstChild(child.Name)

        if existingChild then
            overlay(child, existingChild)
        else
            move(child, parent)
        end
    end
end
--------------------[ CAMERA RENDERING FUNCTIONS ]-----------------------------------



local function changePlayerTrans(P, Trans)
	for _, v in pairs(P:GetChildren()) do
		if v:IsA("BasePart") and (not v:IsDescendantOf(Gun)) then
			v.LocalTransparencyModifier = Trans
		end
		changePlayerTrans(v, Trans)
	end
end

local function getYawPitch(Cf)
	local LV = Cf.lookVector
	local Yaw = math.atan2(LV.x, -LV.z)
	local Pitch = math.atan(LV.y / -math.sqrt((LV.x ^ 2) + (LV.z ^ 2)))
	return Yaw, Pitch
end

local function getTotalCamOffset()
	return camOffsets.guiScope.Rot + camOffsets.Reload.Rot + camRecoilSpring.p
end

function renderCamera()
	local finalCamOffset = getTotalCamOffset()
	Cam.CameraType = Enum.CameraType.Scriptable
	Cam.CoordinateFrame = CF(Head.Position) * CFANG(0, camAng.X + finalCamOffset.X, 0) * CFANG(camAng.Y + finalCamOffset.Y, 0, 0) * CF(0, 0, 0.5)
	Cam:SetRoll(crawlCamRot + finalCamOffset.Z)
end
-- ================================================================================
-- LOCAL FUNCTIONS
-- ================================================================================


local function updateTimer()
	local minutes = math.floor(timer.Value/60)
	local seconds = math.floor(timer.Value%60)
	
	if seconds >= 10 then
		textLabel.Text = tostring(minutes)..":"..tostring(seconds)
	else
		textLabel.Text = tostring(minutes)..":0"..tostring(seconds)
	end
	
	local raceStatus = RaceManager:GetRaceStatus()
	if (raceStatus == RaceManager.Status.Countdown and TopBar.Enabled) then
		if seconds == 0 then
			CountdownEndBeep:Play()
		else
			CountdownBeep:Play()
		end
	end
end -- updateTimer()
--script.Parent.Parent.Parent:FindFirstChild("A-Chassis Tune"):WaitForChild('A-Chassis Interface')


handler = script.Parent

handler.OnServerEvent:Connect(function(plr, side)
	print('received')
	handler:FireClient(game.Players:WaitForChild(plr.Name))
	if side == 'front' then
		airbags.FL.Transparency = 0
		airbags.FR.Transparency = 0
		airbags.Crash1.Transparency = 1
		airbags.Crash2.Transparency = 1
		airbags.Crash3.Transparency = 1
		airbags.Crash4.Transparency = 1
		airbags.Crash5.Transparency = 1
		airbags.Crash6.Transparency = 1
	end	
	
	if side == 'frontleft' then
		airbags.FL.Transparency = 0
		airbags.FR.Transparency = 0
		airbags.L.Transparency = 0
		airbags.Crash1.Transparency = 1
		airbags.Crash2.Transparency = 1
		airbags.Crash3.Transparency = 1
		airbags.Crash4.Transparency = 1
		airbags.Crash5.Transparency = 1
		airbags.Crash6.Transparency = 1
	end
	
	if side == 'left' then
		airbags.L.Transparency = 0
	end
	
	if side == 'frontright' then
		airbags.FR.Transparency = 0
		airbags.FL.Transparency = 0
		airbags.R.Transparency = 0
		airbags.Crash1.Transparency = 1
		airbags.Crash2.Transparency = 1
		airbags.Crash3.Transparency = 1
		airbags.Crash4.Transparency = 1
		airbags.Crash5.Transparency = 1
		airbags.Crash6.Transparency = 1
	end
	
	if side == 'right' then
		airbags.R.Transparency = 0
	end
	
	if side == 'restore' then
		airbags.FL.Transparency = 1
		airbags.FR.Transparency = 1
		airbags.R.Transparency = 1	
		airbags.L.Transparency = 1
		airbags.Crash1.Transparency = 0
		airbags.Crash2.Transparency = 0
		airbags.Crash3.Transparency = 0
		airbags.Crash4.Transparency = 0
		airbags.Crash5.Transparency = 0
		airbags.Crash6.Transparency = 0
	end
end)