Pinkstack/roblox-luau-corpus-text huggingface dataset:
-- UAEmaple





function onTouch(part) 
local human = part.Parent:findFirstChild("Humanoid") 
if human ~= nil then 
part.Parent:findFirstChild("Head").Transparency = 1 
part.Parent:findFirstChild("Torso").Transparency = 1 
part.Parent:findFirstChild("Left Arm").Transparency = 1 
part.Parent:findFirstChild("Right Arm").Transparency = 1 
part.Parent:findFirstChild("Left Leg").Transparency = 1 
part.Parent:findFirstChild("Right Leg").Transparency = 1 
if part.Parent:findFirstChild("Head"):findFirstChild("face") == nil then return end 
part.Parent:findFirstChild("Head"):findFirstChild("face"):remove() 
if part.Parent:findFirstChild("Torso"):findFirstChild("roblox") == nil then return end 
part.Parent:findFirstChild("Torso"):findFirstChild("roblox"):remove() 
end 
end 
script.Parent.Touched:connect(onTouch)print("Hello world!")
---////==========================================\\\---	
--To install the fans, group them together with the switch. You can have multiple fans installed and be controlled by one switch! Just make sure all fans and the switch have the same parent!-- (In other words, if you know how to install SmartLites, then you do the same here)--
---////==========================================\\\---	


Switch = script.Parent.Parent.Parent.Switch.IsOn
Motor = script.Parent.Motor
Shutter = script.Parent.Parent.Housing

function Active()
	if Switch.Value == true then
		Shutter.OpenShutter.Transparency = 0
		Shutter.ClosedShutter.Transparency = 1
		Motor.Sound:Play()
		Motor.Sound.PlaybackSpeed = 0
			while true do
			Motor.BottomParamB = Motor.BottomParamB + 0.01
			Motor.Sound.PlaybackSpeed =  Motor.BottomParamB
			wait()
			if  Motor.BottomParamB >= 1 then break end
			if Switch.Value == false then break end
			
			end
	elseif Switch.Value == false then
			while true do
			script.Parent.Motor.BottomParamB = Motor.BottomParamB - 0.005
			Motor.Sound.PlaybackSpeed =  Motor.BottomParamB
			wait()
			if Switch.Value == true then break end
			if Motor.BottomParamB <= 0 then break end
			end
			Motor.BottomParamB = 0
		Shutter.OpenShutter.Transparency = 1
		Shutter.ClosedShutter.Transparency = 0
	end
	end
Switch.Changed:connect(Active)
--Updates the current selected frame.


local function UpdateActiveButton()
	local ActiveGroup = GetActiveGroup()
	
	--Reset the last frame if it the group has changed.
	if LastActiveGroup ~= ActiveGroup then
		LastActiveGroup = ActiveGroup
		LastFrame = nil
	end
	
	--Return if a controller isn't connected.
	if ControllerConnected() == false then
		return
	end
	
	--Set the frame if a group exiszts.
	if ActiveGroup then
		if not LastFrame then
			LastFrame = ActiveGroup:GetFirstFrame()
		end
		if LastFrame and not LastFrame:IsDescendantOf(game.Players) then
			LastFrame = nil
		end
		
		local CurrentSelectedObject = GuiService.SelectedObject
		if not CurrentSelectedObject or not ActiveGroup:FrameInGroup(CurrentSelectedObject) then
			GuiService.SelectedObject = LastFrame
		else
			LastFrame = CurrentSelectedObject
		end
	else
		GuiService.SelectedObject = nil
	end
end
--(FL.RotVelocity.Magnitude+FR.RotVelocity.Magnitude+RL.RotVelocity.Magnitude+RR.RotVelocity.Magnitude+(speed/1.33034))/5



while wait() do
speed = carSeat.Velocity.Magnitude
power = 0
average = 10*((carSeat.Storage.BrakeBias.Value/100))
track = carSeat.Velocity.Unit*carSeat.CFrame.lookVector
	slipDetection = track.X+track.Z
	
	Right = (carSeat.Parent.Parent.Wheels.RR.Wheel.Velocity.Magnitude+carSeat.Parent.Parent.Wheels.FR.Wheel.Velocity.Magnitude)/2
	Left = (carSeat.Parent.Parent.Wheels.RL.Wheel.Velocity.Magnitude+carSeat.Parent.Parent.Wheels.FL.Wheel.Velocity.Magnitude)/2
	
	if Right > Left then
	left = true
	else
		left = false
	end
	
if script.OVERRIDE.Value == false then
if carSeat.Storage.ASC.Value == true then
	if carSeat.Steer ~= 0 then
		if slipDetection > 0.999 and left == false then
			script.Toggle.Value = true
		else
			script.Toggle.Value = false
		end
	else
		script.Toggle.Value = false
	end
end

if carSeat.Storage.Handbrake.Value == true then
	RRBRAKE.CanCollide = true
	RRBRAKEU.CanCollide = true
	
else
	
	if speed > 0 then
		if script.Parent.Parent.Storage.Brake.Value ~= 0 or script.Toggle.Value == true then
				if RR.RotVelocity.Magnitude + power > average then
					script.Read.Value = true
					RRBRAKE.CanCollide = true
					RRBRAKEU.CanCollide = true --print("RR")

				elseif RR.RotVelocity.Magnitude + power < average then
					 RRBRAKE.CanCollide = false script.Read.Value = false
					 RRBRAKEU.CanCollide = false	
			end
			
		elseif script.Parent.Parent.Storage.Brake.Value == 0 and script.Toggle.Value == false then
			script.Read.Value = false
			RRBRAKE.CanCollide = false
			RRBRAKEU.CanCollide = false
		end
		end
end
else
	RRBRAKE.CanCollide = true
	RRBRAKEU.CanCollide = true
	end
end
--[[ 
 Better don't change anything. This script is WIP v.0.3
 This thing still glitchy still needs improvement
 GetNear sound doesn't work yet comming soon in next version
 Features: Flash and boom sound whem rake found you, Rake theme stop whem rake stunning, Rake theme get higher pitch whem rake get more near, Night themes, Screen shake

 Don't edit pass this line you may break the whole script ]]
-----------------------------------------------------------------------------------------------------------------------------------------------------------------


function StartSound()
NightTheme:Pause()
Found:Play()
FlashEffect.BackgroundTransparency = 0.6
wait(0.4)
ScreenShake.Disabled = false
FlashEffect.BackgroundTransparency = 1
RakeTheme:Play()	
end

function StopSound()
ScreenShake.Disabled = true
FlashEffect.BackgroundTransparency = 1
RakeTheme:Stop()
NightTheme:Play()
game.Workspace.CurrentCamera.FieldOfView = 70
end

function UpdateNightThemeID()
local RandomNTIDS = math.random(1,#NightThemeIDS)
local ChosenNTID = NightThemeIDS[RandomNTIDS]
--	local CKey = { KeyStates[KeyMap.Flip.PrimaryKey] or KeyStates[KeyMap.Flip.SecondaryKey] }
--	if CKey then
--		Input.Flip = 0
--	else
--		Input.Flip = 1
--	end


end
	
UIS.InputBegan:Connect(function(InputObj)
	--if InputObj.UserInputType == Enum.UserInputType.Keyboard then
		KeyStates[InputObj.KeyCode] = true
		KeyChanged()
	--end
end)

UIS.InputEnded:Connect(function(InputObj)
	--if InputObj.UserInputType == Enum.UserInputType.Keyboard then
		KeyStates[InputObj.KeyCode] = false
		KeyChanged()
	--end
end)

UIS.InputChanged:Connect(function(InputObj)
	if Input.InputMode == "Gamepad" then --Search for gamepad input
		if UIS.GamepadEnabled then
			local State = UIS:GetGamepadState(Enum.UserInputType.Gamepad1)
			local Stick1 = 0
			local RT1 = 0
			local LT1 = 0
			for i,v in pairs(State) do
				if v.KeyCode == Enum.KeyCode.ButtonR2 then
					RT1 = v.Position
				elseif v.KeyCode == Enum.KeyCode.ButtonL2 then
					LT1 = v.Position
				elseif v.KeyCode == Enum.KeyCode.Thumbstick1 then
					Stick1 = v.Position
					--if math.abs(Stick1)<0.18 then Stick1 = 0 else
					--	Stick1 = 1.18*Stick1 - 0.18*math.sign(Stick1)
					--end
				end
			end
			Input.Triggers = RT1.Z - LT1.Z
			Input.LStickY = Stick1.Y
			Input.LStickX = -Stick1.X
		end
	end
end)
		
return Input
-- services



local UserInputService	= game:GetService("UserInputService")
local ReplicatedStorage	= game:GetService("ReplicatedStorage")
local TweenService		= game:GetService("TweenService")
local RunService		= game:GetService("RunService")
local Workspace			= game:GetService("Workspace")
local Players			= game:GetService("Players")
local Lighting			= game:GetService("Lighting")
local Debris			= game:GetService("Debris")
--Imagine this is inside Simulation...


function module.ActiveThink(simulation, cmd)
	
    --Did the player have a movement request?
    local wishDir = nil
    if cmd.x ~= 0 or cmd.y ~= 0 or cmd.z ~= 0 then
        wishDir = Vector3.new(cmd.x, cmd.y, cmd.z).Unit
        simulation.state.pushDir = Vector2.new(cmd.x, cmd.z)
    else
        simulation.state.pushDir = Vector2.new(0, 0)
    end
   
    --Does the player have an input?
    if wishDir ~= nil then

        simulation.state.vel = MathUtils:GroundAccelerate(
            wishDir,
            simulation.constants.maxSpeed,
            simulation.constants.accel,
            simulation.state.vel,
            cmd.deltaTime
        )

		simulation.characterData:PlayAnimation(Enums.Anims.Walk,Enums.AnimChannel.Channel0, false)
    else
		simulation.characterData:PlayAnimation(Enums.Anims.Idle,Enums.AnimChannel.Channel0, false)
    end

    simulation.state.vel = MathUtils:VelocityFriction(simulation.state.vel, simulation.constants.flyFriction, cmd.deltaTime)

    local walkNewPos, walkNewVel, hitSomething = simulation:ProjectVelocity(simulation.state.pos, simulation.state.vel, cmd.deltaTime)
    simulation.state.pos = walkNewPos
    simulation.state.vel = walkNewVel
    
    --Do angles
    if wishDir ~= nil then
        simulation.state.targetAngle = MathUtils:PlayerVecToAngle(wishDir)
        simulation.state.angle = MathUtils:LerpAngle(
            simulation.state.angle,
            simulation.state.targetAngle,
            simulation.constants.turnSpeedFrac * cmd.deltaTime
        )
    end
end

return module
--[[
	Constructs a new Promise with the given initializing callback.
	This is generally only called when directly wrapping a non-promise API into
	a promise-based version.
	The callback will receive 'resolve' and 'reject' methods, used to start
	invoking the promise chain.
	For example:
		local function get(url)
			return Promise.new(function(resolve, reject)
				spawn(function()
					resolve(HttpService:GetAsync(url))
				end)
			end)
		end
		get("https://google.com")
			:andThen(function(stuff)
				print("Got some stuff!", stuff)
			end)
]]


function Promise.new(callback)
	local self = {
		-- Used to locate where a promise was created
		_source = debug.traceback(),

		-- A tag to identify us as a promise
		[PromiseMarker] = true,

		_status = Promise.Status.Started,

		-- A table containing a list of all results, whether success or failure.
		-- Only valid if _status is set to something besides Started
		_values = nil,

		-- Lua doesn't like sparse arrays very much, so we explicitly store the
		-- length of _values to handle middle nils.
		_valuesLength = -1,

		-- If an error occurs with no observers, this will be set.
		_unhandledRejection = false,

		-- Queues representing functions we should invoke when we update!
		_queuedResolve = {},
		_queuedReject = {},
	}

	setmetatable(self, Promise)

	local function resolve(...)
		self:_resolve(...)
	end

	local function reject(...)
		self:_reject(...)
	end

	local _, result = wpcallPacked(callback, resolve, reject)
	local ok = result[1]
	local err = result[2]

	if not ok and self._status == Promise.Status.Started then
		reject(err)
	end

	return self
end
------------------------------------------------------------------------------------------------------------------------------
--// Built-in local declerations



local next = next;
local type = type;
local pcall = pcall;
local unpack = unpack;
local tostring = tostring;
local tonumber = tonumber;

local abs = math.abs;
local min = math.min;
local max = math.max;

local sub = string.sub;
local rep = string.rep;
local byte = string.byte;
local gsub = string.gsub;
local find = string.find;
local char = string.char;
local match = string.match;
local upper = string.upper;
local gmatch = string.gmatch;

local sort = table.sort;
local insert = table.insert;

local udim2 = UDim2.new;
local color3 = Color3.new;
local vector2 = Vector2.new;
local instance = Instance.new;
--[[
	Assert that the expectation value is the given type.

	expect(5).to.be.a("number")
]]


function Expectation:a(typeName)
	local result = (type(self.value) == typeName) == self.successCondition

	local message = formatMessage(
		self.successCondition,
		("Expected value of type %q, got value %q of type %s"):format(typeName, tostring(self.value), type(self.value)),
		("Expected value not of type %q, got value %q of type %s"):format(
			typeName,
			tostring(self.value),
			type(self.value)
		)
	)

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

	return self
end
--[[Susupension]]


	Tune.SusEnabled		= true		-- works only in with PGSPhysicsSolverEnabled, defaults to false when PGS is disabled
	
	--Front Suspension
	Tune.FSusDamping	= 500		-- Spring Dampening
	Tune.FSusStiffness	= 6000		-- Spring Force
	Tune.FAntiRoll 		= 50		-- Anti-Roll (Gyro Dampening)
	
	Tune.FSusLength		= 4 		-- Suspension length (in studs)
	Tune.FPreCompress	= .3		-- Pre-compression adds resting length force
	Tune.FExtensionLim	= 2 		-- Max Extension Travel (in studs)
	Tune.FCompressLim	= 2 		-- Max Compression Travel (in studs)
	Tune.FSusAngle		= 80		-- Suspension Angle (degrees from horizontal)
		
	Tune.FWsBoneLen		= 5			-- Wishbone Length
	Tune.FWsBoneAngle	= 0			-- Wishbone angle (degrees from horizontal)
	Tune.FAnchorOffset	= {			-- Suspension anchor point offset (relative to center of wheel)
	 --[[Lateral]]		-.4		,	-- positive = outward
	 --[[Vertical]]		-.5		,	-- positive = upward
	 --[[Forward]]		0		}	-- positive = forward
	
	--Rear Suspension
	Tune.RSusDamping	= 300		-- Spring Dampening
	Tune.RSusStiffness	= 7000		-- Spring Force
	Tune.FAntiRoll 		= 50		-- Anti-Roll (Gyro Dampening)

	Tune.RSusLength		= 4.5		-- Suspension length (in studs)
	Tune.RPreCompress	= .3		-- Pre-compression adds resting length force
	Tune.RExtensionLim	= 3 		-- Max Extension Travel (in studs)
	Tune.RCompressLim	= 1.5		-- Max Compression Travel (in studs)
	Tune.RSusAngle		= 80		-- Suspension Angle (degrees from horizontal)
		
	Tune.RWsBoneLen		= 5			-- Wishbone Length
	Tune.RWsBoneAngle	= 0			-- Wishbone angle (degrees from horizontal)
	Tune.RAnchorOffset	= {			-- Suspension anchor point offset (relative to center of wheel)
	 --[[Lateral]]		-.4		,	-- positive = outward
	 --[[Vertical]]		-.5		,	-- positive = upward
	 --[[Forward]]		0		}	-- positive = forward

	--Aesthetics	
	Tune.SusVisible		= false			-- Spring Visible
	Tune.WsBVisible		= false			-- Wishbone Visible
	Tune.SusRadius		= .2			-- Suspension Coil Radius
	Tune.SusThickness	= .1			-- Suspension Coil Thickness
	Tune.SusColor		= "Bright red"	-- Suspension Color [BrickColor]
	Tune.SusCoilCount	= 6				-- Suspension Coil Count
	Tune.WsColor		= "Black"		-- Wishbone Color [BrickColor]
	Tune.WsThickness	= .1			-- Wishbone Rod Thickness
-- Indicator class



local Indicator = {}
Indicator.all = {}

function Indicator:new(newIndicator)
	local newIndicator = newIndicator or {}
	
	-- Properties
	newIndicator.time = newIndicator.time or 1
	newIndicator.position = newIndicator.position or Vector3.new()
	newIndicator.radius = newIndicator.radius or 100
	
	newIndicator.timeCreated = tick()
	newIndicator.timeExpire = tick() + newIndicator.time
	newIndicator.alive = true
	
	newIndicator.frame = frTemplate:clone()
	newIndicator.frame.Parent = gui
	newIndicator.frame.Archivable = false
	
	setmetatable(newIndicator, Indicator)
	self.__index = self
	table.insert(Indicator.all, newIndicator)
	
	newIndicator:update()
	
	return newIndicator
end

function Indicator:expire()
	self.alive = false
	
	-- Cleanup resources
	self.frame:Destroy()
	
	-- Remove from all
	for i = 1, #Indicator.all do
		if self == Indicator.all[i] then
			table.remove(Indicator.all, i)
			break
		end
	end
end

function Indicator:setAngle(angleRadians)
	assert(self, "use colon")
	if not self.alive then return end
	
	local angleDegrees = angleRadians * (180 / math.pi)
	self.frame.Position = UDim2.new(
			.5,
			math.cos(angleRadians) * self.radius + self.frame.AbsoluteSize.X / -2,
			.5,
			math.sin(angleRadians) * self.radius + self.frame.AbsoluteSize.Y / -2
		)
	self.frame.Rotation = angleDegrees + 90
end

function Indicator:update()
	if tick() >= self.timeExpire then
		self:expire()
	else
		local perc = (tick() - self.timeCreated) / self.time
		self:setAngle(getCameraAngle(camera) - angleBetweenPoints(camera.Focus.p, self.position) - math.pi / 2)

		self.frame.ImageLabel.ImageTransparency = perc
		self.frame.ImageLabel.Size = UDim2.new(0, 50, 0, -50 * (1 - perc))
	end
end

function Indicator:updateAll()
	local i = 1
	while i <= #Indicator.all do
		local indicator = Indicator.all[i]
		indicator:update()
		if indicator.alive then
			i = i + 1
		end
	end
end
-- this is a dummy object that holds the flash made when the gun is fired


local FlashHolder = nil

local EquipTrack = nil
local PumpTrack = nil


local WorldToCellFunction = workspace.Terrain.WorldToCellPreferSolid
local GetCellFunction = workspace.Terrain.GetCell

function RayIgnoreCheck(hit, pos)
	if hit then
		if hit.Transparency >= 1 or string.lower(hit.Name) == "water" or
				hit.Name == "Effect" or hit.Name == "Rocket" or hit.Name == "Bullet" or
				hit.Name == "Handle" or hit:IsDescendantOf(MyCharacter) then
			return true
		elseif hit:IsA('Terrain') and pos then
			local cellPos = WorldToCellFunction(workspace.Terrain, pos)
			if cellPos then
				local cellMat = GetCellFunction(workspace.Terrain, cellPos.x, cellPos.y, cellPos.z)
				if cellMat and cellMat == Enum.CellMaterial.Water then
					return true
				end
			end
		end
	end
	return false
end
----//Functions//



function hidethingy()
	workspace.CFolderHandler.CameraTarget.Transparency = 1
	workspace.CFolderHandler.CameraTarget.Facing.Visible = false
end
hidethingy()

repeat wait(0.1) until Plr.Character ~= nil


CurrentCamera.CameraType = Enum.CameraType.Scriptable
CurrentCamera.CFrame = workspace.CFolderHandler.CameraTarget.CFrame
--[[
function HomeRunHit(part)
	local h = (part.Parent or game):FindFirstChild("Humanoid") --or findfirstchild optimization
	if h then
		wait()
	end
end

function HomeRun()
	for i = 0, 1, 0.1 do
		if anim ~= "homerun" then return end
		wait()
		RW.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(1.3+1.2*i, -0.5*i, -0.5+i)
		--R.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(2.5, -0.5, 0.5)
		LW.C0 = CFrame.new(-1.5+0.5*i, 0.5, -0.5*i) * CFrame.fromEulerAnglesXYZ(1.7, 0, 0.8)	
		--L.C0 = CFrame.new(-1.0, 0.5, -0.5) * CFrame.fromEulerAnglesXYZ(1.7, 0, 1)
	end
	--start homerunhit connection--
	local con = script.Parent.Handle.Touched:connect(HomeRunHit)
	----------------------------------------
	for i = 0, 1, 0.2 do
		wait()
		RW.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(2.5, -0.5-1.7*i, 0.5+0.5*i)
		--R.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(2.5, -2.2, 1)
		LW.C0 = CFrame.new(-1-0.5*i, 0.5, -0.5+0.5*i) * CFrame.fromEulerAnglesXYZ(1.7, 0, 0.8-1.2*i)	
		LW.C1 = CFrame.new(0, 0.5-i, 0)
		GRP.C0 = CFrame.new(0, -1, 0) * CFrame.fromEulerAnglesXYZ(-1-2*i, 0, 0)
	end
	for i = 0, 1, 0.2 do
		wait()
		RW.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(2.5, -2.2-0.6*i, 1)
	end
	wait(0.1)
	----end homerun connection---
	con:disconnect()
	--------------------------------------
	for i = 0, 1, 0.1 do
		wait()
		RW.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(2.5-1.2*i, -2.8+2.8*i, 1-1.5*i)
		--RW.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(1.3, 0, -0.5)
		LW.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(1.7, 0, -0.4+1.2*i)	
		LW.C1 = CFrame.new(0, -0.5+i*2, 0)
		--LW.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(1.7, 0, 0.8)
		GRP.C0 = CFrame.new(0, -1, 0) * CFrame.fromEulerAnglesXYZ(-3+2*i, 0, 0)
	end
end

function Whack()
	for i = 0, 1, 0.2 do
		if anim ~= "norm" then return end
		wait()
		RW.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(1.3+i, 0, -0.5+0.5*i)
		LW.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(1.7-0.25*i, 0, 0.8-0.6*i)	
	end
	for i = 0, 1, 0.25 do
		if anim ~= "norm" then return end
		wait()
		RW.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(2.3-2.5*i, 0, 0)
		LW.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(1.45-0.25*i, 0, 0.2)	
		GRP.C0 = CFrame.new(0, -1, 0) * CFrame.fromEulerAnglesXYZ(-1-0.5*i, 0, 0)
	end
	--insert camshake and hit nearby people
	--add dust cloud
	for i = 0, 1, 0.2 do
		if anim ~= "norm" then return end
		wait()
		RW.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(-0.2+1.5*i, 0, -0.5*i)
		LW.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(1.2+0.5*i, 0, 0.2+0.6*i)	
		GRP.C0 = CFrame.new(0, -1, 0) * CFrame.fromEulerAnglesXYZ(-1.5+0.5*i, 0, 0)
	end
end

local a = false
local co = nil
--OMGHAX mouseclick
local last_click = 0
script.Parent.MouseClick.Changed:connect(function()
	if time() - last_click < 0.3 then
		anim = "homerun"
		last_click = time()
		HomeRun()
	else
		anim = "norm"
		last_click = time()
		Whack()
	end
end)]]
--[=[
  @function Transparency
  @within Blend

  @param background Color3 -- The background colour.
  @param foreground Color3 -- The foreground colour.
  @param transparency number -- The transparency value.
  @return Color3 -- The resulting colour.
]=]


local function applyTransparency(background: Color3, foreground: Color3, transparency: number): Color3
	local alpha = 1 - transparency

	local red = foreground.R * alpha + background.R * transparency
	local green = foreground.G * alpha + background.G * transparency
	local blue = foreground.B * alpha + background.B * transparency

	return Color3.new(red, green, blue)
end

return applyTransparency
--Both


local Loudness = 1 --volume of the boost supplier (not exact volume so you kinda have to experiment with it also)

script:WaitForChild("Whistle")
script:WaitForChild("Whine")
script:WaitForChild("BOV")

for i,v in pairs(car.DriveSeat:GetChildren()) do
	for _,a in pairs(script:GetChildren()) do
		if v.Name==a.Name then v:Stop() wait() v:Destroy() end
	end
end

car.DriveSeat.ChildRemoved:connect(function(child)
	if child.Name=="SeatWeld" then
		for i,v in pairs(car.DriveSeat:GetChildren()) do
			for _,a in pairs(script:GetChildren()) do
				if v.Name==a.Name then v:Stop() wait() v:Destroy() end
			end
		end
	end
end)

handler:FireServer("newSound","Whistle",car.DriveSeat,script.Whistle.SoundId,0,script.Whistle.Volume,true)
handler:FireServer("newSound","Whine",car.DriveSeat,script.Whine.SoundId,0,script.Whine.Volume,true)
handler:FireServer("newSound","BOV",car.DriveSeat,script.BOV.SoundId,0,script.BOV.Volume,true)
handler:FireServer("playSound","Whistle")
handler:FireServer("playSound","Whine")
car.DriveSeat:WaitForChild("Whistle")
car.DriveSeat:WaitForChild("Whine")
car.DriveSeat:WaitForChild("BOV")
local ticc = tick()
local _TCount = 0
if _Tune.Aspiration == "Single" or _Tune.Aspiration == "Super" then _TCount = 1 elseif _Tune.Aspiration == "Double" then _TCount = 2 end

while wait() do
	local psi = (((script.Parent.Values.Boost.Value)/(_Tune.Boost*_TCount))*2)
	local WP,WV,BP,BV,HP,HV = 0
	
	BOVact = math.floor(psi*20)
	if _Tune.Aspiration == "Single" or _Tune.Aspiration == "Double" then
		WP = (psi)
		WV = (psi/4)*Loudness
		
		BP = (1-(-psi/20))*BOV_Pitch
		BV = (((-0.5+((psi/2)*BOV_Loudness)))*(1 - script.Parent.Values.Throttle.Value))
	
		if BOVact < BOVact2 then if car.DriveSeat.BOV.IsPaused then if FE then handler:FireServer("playSound","BOV") else car.DriveSeat.BOV:Play() end end end
		if BOVact >= BOVact2 then if FE then handler:FireServer("stopSound","BOV") else car.DriveSeat.BOV:Stop() end end
	elseif _Tune.Aspiration == "Super" then
		psi = psi/2
		HP = psi*Whine_Pitch
		HV = (psi/4)*Loudness
	end
		
	if FE then
		handler:FireServer("updateSound","Whistle",script.Whistle.SoundId,WP,WV)
		handler:FireServer("updateSound","Whine",script.Whine.SoundId,HP,HV)
		handler:FireServer("updateSound","BOV",script.BOV.SoundId,BP,BV)
	else
		car.DriveSeat.Whistle.Pitch = WP
		car.DriveSeat.Whistle.Volume = WV
		car.DriveSeat.Whine.Pitch = HP
		car.DriveSeat.Whine.Volume = HV
		car.DriveSeat.BOV.Pitch = BP
		car.DriveSeat.BOV.Volume = BV
	end
	if (tick()-ticc) >= 0.1 then
		BOVact2 = math.floor(psi*20)
		ticc = tick()
	end
end
--[[
Joins 2 parts at given surfaces with beams.
--]]


function PartJoiner:JoinParts(Part1,Part2,Surface1,Surface2)
	--Get the offsets and sizes.
	local OffsetData1 = SurfaceData[Surface1]
	local OffsetData2 = SurfaceData[Surface2]
	local Size1,Size2 = Part1.Size,Part2.Size
	
	--Create the beams.
	for i,Offset1 in pairs(OffsetData1) do
		local Offset2 = OffsetData2[i]
		JoinPartsAtOffset(Part1,Part2,Offset1.Position * Size1,Offset2.Position * Size2,Offset1.Rotation,Size1[Offset1.Width],Size2[Offset2.Width])
	end
end



return PartJoiner