Roblox/luau_corpus 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}
-- create the viewmodel
local viewmodel = Instance.new("Model")
local fakeroot = Instance.new("Part")
viewmodel.Name = "Viewmodel"
fakeroot.Name = "HumanoidRootPart"
fakeroot.CanCollide = false
fakeroot.CanTouch = false
fakeroot.Anchored = true
----------//Collapse\\----------
ACS_Client:GetAttributeChangedSignal("Collapsed"):Connect(function()
	if not ACS_Client:GetAttribute("Collapsed") then return; end;
	runKeyDown 	= true
	Stand()
	Stances = 0
	Virar = 0
	CameraX = 0
	CameraY = 0
	Lean()
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
--[[
	Promise.new, except Promise.spawn is implicit.
]]
function Promise.async(callback)
	return Promise.new(function(...)
		return Promise.spawn(callback, ...)
	end)
end
--DO NOT CHANGE ANYTHING INSIDE OF THIS SCRIPT BESIDES WHAT YOU ARE TOLD TO UNLESS YOU KNOW WHAT YOU'RE DOING OR THE SCRIPT WILL NOT WORK!!
local hitPart = script.Parent
local debounce = true
local tool = game.ServerStorage.IceSliding
-- 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)
-- 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
-- Decompiled with the Synapse X Luau decompiler.

local l__mouse__1 = game.Players.LocalPlayer:GetMouse();
local l__Value__2 = script.Parent.Car.Value;
local l__Horn_FE__3 = l__Value__2:WaitForChild("Horn_FE");
local l__Horn__1 = l__Value__2.DriveSeat:WaitForChild("Horn");
l__mouse__1.KeyDown:connect(function(p1)
	if p1 == "h" then
		l__Horn__1:Play();
	end;
end);
l__mouse__1.KeyUp:connect(function(p2)
	if p2 == "h" then
		l__Horn__1:Stop();
	end;
end);
local l__FilteringEnabled__2 = workspace.FilteringEnabled;
game:GetService("UserInputService").InputBegan:connect(function(p3, p4)
	if p3.KeyCode == Enum.KeyCode.H and p3.UserInputState == Enum.UserInputState.Begin then
		if not l__FilteringEnabled__2 then
			l__Horn__1:Play();
			return;
		end;
	else
		return;
	end;
	l__Horn_FE__3:FireServer(true);
end);
game:GetService("UserInputService").InputEnded:connect(function(p5, p6)
	if p5.KeyCode == Enum.KeyCode.H and p5.UserInputState == Enum.UserInputState.End then
		if not l__FilteringEnabled__2 then
			l__Horn__1:Stop();
			return;
		end;
	else
		return;
	end;
	l__Horn_FE__3:FireServer(false);
end);
--Variables
local PrimaryPart = script.Parent.Parent.PrimaryPart
local open = false
local Door = script.Parent.Parent
local Proximity = script.Parent:WaitForChild("ProximityPrompt")
local OpenSound = script.Parent.Sounds.Open
local CloseSound = script.Parent.Sounds.Close
--[=[
	Constructs a new Signal

	@return Signal
]=]
function Signal.new()
	local self = setmetatable({
		_handlerListHead = false,
		_proxyHandler = nil,
	}, Signal)
	return self
end
-- List of UI elements
local UIElements = { 'SelectNote', 'ModeOption', 'SideOption', 'ImageIDOption', 'TransparencyOption', 'RepeatOption', 'AddButton', 'RemoveButton' };
--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)
-- 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
-- Get reference to the Dock frame
local dock = script.Parent.Parent.MobileDock
--[[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 = {}
-- Get references to the DockShelf and its children
local dockShelf = script.Parent.Parent.Parent.Parent.Parent.DockShelf
local aFinderButton = dockShelf.FMusic
local opened = aFinderButton.Opened
local Minimalise = script.Parent
local window = script.Parent.Parent.Parent
--[[
	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
--Plot Current Horsepower
function GetCurve(x,gear)
	local hp=math.max((curve(x)*_Tune.Horsepower)/PeakCurve,0)
	return hp,hp*(_Tune.EqPoint/x)*_Tune.Ratios[gear+2]*fFD*hpScaling
end
-- 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
-- SERVICES --
local RS = game:GetService("ReplicatedStorage")
local TS = game:GetService("TweenService")
local Players = game:GetService("Players")
--------------------[ 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
--CHANGE THIS LINE--
Signal = script.Parent.Parent.Parent.ControlBox.SignalValues.Signal2 -- Change last word
--Scripts
script.Parent.PlacementScript.Parent = game.ServerScriptService
script.Parent.PlayerMouseScript.Parent = game.StarterPlayer.StarterPlayerScripts
-- ================================================================================
-- 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()