Roblox/luau_corpus huggingface dataset:
--[[[Default Controls]]
	--Peripheral Deadzones
	Tune.Peripherals = {
		MSteerWidth				= 67		,	-- Mouse steering control width	(0 - 100% of screen width)
		MSteerDZone				= 10		,	-- Mouse steering deadzone (0 - 100%)
		
		ControlLDZone			= 5			,	-- Controller steering L-deadzone (0 - 100%)
		ControlRDZone			= 5			,	-- Controller steering R-deadzone (0 - 100%)
	}
	
	--Control Mapping
	Tune.Controls = {
		
	--Keyboard Controls
		--Mode Toggles
		ToggleABS				= Enum.KeyCode.Y					,
		ToggleTransMode			= Enum.KeyCode.M					,
		--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.DPadRight			,
		ContlrToggleTCS			= Enum.KeyCode.DPadRight				,
		ContlrToggleABS			= Enum.KeyCode.DPadRight			,
	}
-- Variables.
local loadingScreen = script.LoadingScreen
local player = game.Players.LocalPlayer

local clonedLoadingScreen = loadingScreen:Clone()
clonedLoadingScreen.Parent = player:WaitForChild("PlayerGui")

local frame = clonedLoadingScreen.Frame
local bar = frame.LoadingBar
local inside = bar.BarInfill
local skipButton = frame.SkipFrame.SkipButton
local loadingPercentage = frame.DisplayPercentage

local screenVisible = true
local hideAfter = 30
--The server will fire the ExitSeat remote to the client when the humanoid has been removed from a seat.
--This script listens to that and uses it to prevent the humanoid tripping when exiting a seat.
--As the player is removed from the seat server side, this scripts listens to the event instead of being
-- inside the ExitSeat function so that:
-- A) The timing is right - the exit seat function will run before the character is unsat by the server
-- B) If a server script removes the player from a seat, the anti-trip will still run
local function antiTrip()
	local humanoid = getLocalHumanoid()
	if humanoid then
		humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
	end
end
Remotes.ExitSeat.OnClientEvent:Connect(function(doAntiTrip)
	for _, func in pairs(module.OnExitFunctions) do
		func(nil)
	end
	if doAntiTrip then
		antiTrip()
	end
end)

return module
--[=[
	Converts this arbitrary value into an observable that will initialize a spring
	and interpolate it between values upon subscription.

	```lua
	local percentVisible = Blend.State(0)
	local visibleSpring = Blend.Spring(percentVisible, 30)
	local transparency = Blend.Computed(visibleSpring, function(percent)
		return 1 - percent
	end);

	Blend.mount(frame, {
		BackgroundTransparency = visibleSpring;
	})
	```

	@param source any
	@param speed any
	@param damper any
	@return Observable?
]=]
function Blend.Spring(source, speed, damper)
	local sourceObservable = Blend.toPropertyObservable(source) or Rx.of(source)
	local speedObservable = Blend.toNumberObservable(speed)
	local damperObservable = Blend.toNumberObservable(damper)

	local function createSpring(maid, initialValue)
		local spring = Spring.new(initialValue)

		if speedObservable then
			maid:GiveTask(speedObservable:Subscribe(function(value)
				assert(type(value) == "number", "Bad value")
				spring.Speed = value
			end))
		end

		if damperObservable then
			maid:GiveTask(damperObservable:Subscribe(function(value)
				assert(type(value) == "number", "Bad value")

				spring.Damper = value
			end))
		end

		return spring
	end

	-- TODO: Centralize and cache
	return Observable.new(function(sub)
		local spring
		local maid = Maid.new()

		local startAnimate, stopAnimate = StepUtils.bindToRenderStep(function()
			local animating, position = SpringUtils.animating(spring)
			sub:Fire(SpringUtils.fromLinearIfNeeded(position))
			return animating
		end)

		maid:GiveTask(stopAnimate)
		maid:GiveTask(sourceObservable:Subscribe(function(value)
			if value then
				local linearValue = SpringUtils.toLinearIfNeeded(value)
				spring = spring or createSpring(maid, linearValue)
				spring.t = SpringUtils.toLinearIfNeeded(value)
				startAnimate()
			else
				warn("Got nil value from emitted source")
			end
		end))

		return maid
	end)
end
--Misc
Tune.AutoStart		= true --set to false if using manual ignition plugin
Tune.AutoFlip		= true
--// SS3 controls for AC6 by Itzt, originally for 2014 Infiniti QX80. i don't know how to tune ac lol
 
wait(0.1)
local player = game.Players.LocalPlayer
local HUB = script.Parent.HUB
local TR = script.Parent.Tracker
local limitButton = HUB.Name
local FE = game.Workspace.FilteringEnabled
local lightOn = false
local Camera = game.Workspace.CurrentCamera
local cam = script.Parent.nxtcam.Value
local carSeat = script.Parent.CarSeat.Value
local mouse = game.Players.LocalPlayer:GetMouse()
local windows = false
local handler = carSeat:WaitForChild('Filter')
local winfob = HUB.Parent.Music
local pal = false
local palpal = HUB.Parent.Palette
local red = 0
local green = 0
local blue = 1
local debounce = false
-- Replace the values of these variables with true or false to control which Core GUI elements should be disabled initially
local DISABLE_COREUI = EasyLoadConfig.ShowCoreUI
---[[ Fade Out and In Settings ]]
module.ChatWindowBackgroundFadeOutTime = 0 --Chat background will fade out after this many seconds.
module.ChatWindowTextFadeOutTime = 60				--Chat text will fade out after this many seconds.
module.ChatDefaultFadeDuration = 0.8
module.ChatShouldFadeInFromNewInformation = true
module.ChatAnimationFPS = 20.0
--[=[
	@type ClientMiddleware {ClientMiddlewareFn}
	@within KnitClient
	An array of client middleware functions.
]=]
type ClientMiddleware = {ClientMiddlewareFn}
--// F key, HornOff
mouse.KeyUp:connect(function(key)
	if key=="h" then 
		veh.Lightbar.middle.Airhorn:Stop()
		veh.Lightbar.middle.Wail.Volume = 1
		veh.Lightbar.middle.Yelp.Volume = 1
		veh.Lightbar.middle.Priority.Volume = 1
		veh.Lightbar.HORN.Transparency = 1
	end
end)
--Head
R6HeadYFinish = .4 --Max left and right movement of the Head
R6HeadYStart = .2 --Minimum left and right movement of the Head
R6HeadX = .5 --Side to side movement of the Head
R6HeadZ = .3 --Up and down movement of the Head
-------------------------
function onClicked()
R.Function1.Disabled = false
R.BrickColor = BrickColor.new("Really black")
R.Function2.Disabled = true

end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
-- Ride variables
GameSettings.Platform = {
	["MOVE_SPEED"] = 40
}
--
-- THESE ARE THE CORE SETTINGS
-- YOU WILL NOT BE ABLE TO CHANGE THEM IN-GAME
local Settings={
								--[[
Style Options
�������������					]]
Flat=false;						-- Enables Flat theme / Disables Aero theme
ForcedColor=false;				-- Forces everyone to have set color & transparency
Color=Color3.new(0,0,0);		-- Changes the Color of the user interface
ColorTransparency=.75;			-- Changes the Transparency of the user interface
Chat=false;						-- Enables the custom chat
BubbleChat=false;				-- Enables the custom bubble chat
								--[[
Basic Settings
��������������					]]
AdminCredit=true;				-- Enables the credit GUI for that appears in the bottom right
AutoClean=false;				-- Enables automatic cleaning of hats & tools in the Workspace
AutoCleanDelay=60;				-- The delay between each AutoClean routine
CommandBar=true;				-- Enables the Command Bar | GLOBAL KEYBIND: \
FunCommands=true;				-- Enables fun yet unnecessary commands
FreeAdmin=1;	                -- Set to 1-5 to grant admin powers to all, otherwise set to false
PublicLogs=false;				-- Allows all users to see the command & chat logs
Prefix=':';						-- Character to begin a command
								--[[
Admin Powers
������������
0			Player
1			VIP					Can use nonabusive commands only on self
2			Moderator			Can kick, mute, & use most commands
3			Administrator		Can ban, crash, & set Moderators/VIP
4			SuperAdmin			Can grant permanent powers, & shutdown the game
5			Owner				Can set SuperAdmins, & use all the commands
6			Game Creator		Can set owners & use all the commands

Group & VIP Admin
�����������������
			You can set multiple Groups & Ranks to grant users admin powers
GroupAdmin={
[12345]={[254]=4,[253]=3};
[GROUPID]={[RANK]=ADMINPOWER}
};
			You can set multiple Assets to grant users admin powers
VIPAdmin={
[12345]=3;
[54321]=4;
[ITEMID]=ADMINPOWER;
};								]]

GroupAdmin={

};

VIPAdmin={

};

								--[[
Permissions
�����������
-- You can set the admin power required to use a command
-- COMMANDNAME=ADMINPOWER;		]]

Permissions={

};

}

return {Settings,{Owners,SuperAdmins,Admins,Mods,VIP,Banned}}
-- ONLY SUPPORTS ORDINAL TABLES (ARRAYS). Takes *n* objects from a table and returns a new table only containing those objects.
Table.take = function (tbl, n)
	return table.move(tbl, 1, n, 1, table.create(n))
end
--[=[
	Provides utilities for working with valuesbase objects, like IntValue or ObjectValue in Roblox.
	@class ValueBaseUtils
]=]

local ValueBaseUtils = {}

function ValueBaseUtils.isValueBase(instance)
	return typeof(instance) == "Instance" and instance.ClassName:sub(-#"Value") == "Value"
end

function ValueBaseUtils.getOrCreateValue(parent, instanceType, name, defaultValue)
	assert(typeof(parent) == "Instance", "Bad argument 'parent'")
	assert(type(instanceType) == "string", "Bad argument 'instanceType'")
	assert(type(name) == "string", "Bad argument 'name'")

	local foundChild = parent:FindFirstChild(name)
	if foundChild then
		if not foundChild:IsA(instanceType) then
			warn(("[ValueBaseUtils.getOrCreateValue] - Value of type %q of name %q is of type %q in %s instead")
				:format(instanceType, name, foundChild.ClassName, foundChild:GetFullName()))
		end

		return foundChild
	else
		local newChild = Instance.new(instanceType)
		newChild.Name = name
		newChild.Value = defaultValue
		newChild.Parent = parent

		return newChild
	end
end

function ValueBaseUtils.setValue(parent, instanceType, name, value)
	assert(typeof(parent) == "Instance", "Bad argument 'parent'")
	assert(type(instanceType) == "string", "Bad argument 'instanceType'")
	assert(type(name) == "string", "Bad argument 'name'")

	local foundChild = parent:FindFirstChild(name)
	if foundChild then
		if not foundChild:IsA(instanceType) then
			warn(("[ValueBaseUtils.setValue] - Value of type %q of name %q is of type %q in %s instead")
				:format(instanceType, name, foundChild.ClassName, foundChild:GetFullName()))
		end

		foundChild.Value = value
	else
		local newChild = Instance.new(instanceType)
		newChild.Name = name
		newChild.Value = value
		newChild.Parent = parent
	end
end

function ValueBaseUtils.getValue(parent, instanceType, name, default)
	assert(typeof(parent) == "Instance", "Bad argument 'parent'")
	assert(type(instanceType) == "string", "Bad argument 'instanceType'")
	assert(type(name) == "string", "Bad argument 'name'")

	local foundChild = parent:FindFirstChild(name)
	if foundChild then
		if foundChild:IsA(instanceType) then
			return foundChild.Value
		else
			warn(("[ValueBaseUtils.getValue] - Value of type %q of name %q is of type %q in %s instead")
				:format(instanceType, name, foundChild.ClassName, foundChild:GetFullName()))
			return nil
		end
	else
		return default
	end
end

function ValueBaseUtils.createGetSet(instanceType, name)
	assert(type(instanceType) == "string", "Bad argument 'instanceType'")
	assert(type(name) == "string", "Bad argument 'name'")

	return function(parent, defaultValue)
		assert(typeof(parent) == "Instance", "Bad argument 'parent'")

		return ValueBaseUtils.getValue(parent, instanceType, name, defaultValue)
	end, function(parent, value)
		assert(typeof(parent) == "Instance", "Bad argument 'parent'")

		return ValueBaseUtils.setValue(parent, instanceType, name, value)
	end, function(parent, defaultValue)
		return ValueBaseUtils.getOrCreateValue(parent, instanceType, name, defaultValue)
	end
end

return ValueBaseUtils
-- NOTE: TEXTBOUNDS.X CANNOT BE MORE THAN TEXTLABEL.ABSOLUTESIZE.X OR YOU WILL GET UNDESIRABLE BEHAVIOR

local root = script.Parent

local surfaces = {
	'Front',
	'Left',
	'Back',
	'Right'
}

local speed = 2 -- how many seconds it should take to travel across one surface
local size = 2 -- the number of textlabels to move before and after the current one

function GetPreceedingLabels(index)
	local labels = {}
	
	for i=1,size do
		local this = index-i
		
		table.insert(labels, 
			root:FindFirstChild(surfaces[this] or surfaces[#surfaces+this], true).Frame.TextLabel
		)
	end
	
	return labels
end

function GetSucceedingLabels(index)
	local labels = {}
	
	for i=1,size do
		local this = index+i
--[[Wheel Alignment]]
	--[Don't physically apply alignment to wheels]
	--[Values are in degrees]
	Tune.FCamber		= -1
	Tune.RCamber		= -1
	Tune.FCaster		= 0
	Tune.FToe			= 0
	Tune.RToe			= 0
-- initialize to idle
playAnimation("idle", 0.1, Humanoid)
pose = "Standing"
	
while Figure.Parent~=nil do
	local _, time = wait(0.1)
	move(time)
end
--[=[
	@type PerServiceMiddleware {[string]: Middleware}
	@within KnitClient
]=]
type PerServiceMiddleware = {[string]: Middleware}
-- << SETTINGS >>
Settings={
	-- <Prefix>
	Prefix			=";" ;			-- The character used to begin each command
	
	-- <Owner chat colour>
	OwnerChatColour = "y" ;			--w/r/g/b/p/y    OR    white/red/green/blue/purple/yellow

	-- <Donor Perks>   **Please keep enabled to help support the development of HD Admin Commands**
	DonorItem 		= true ;
	DonorItemId 	= 10472779 ;
	DonorCommands 	= true ;
	
	-- <Other>
	CmdBar			= true ;		-- Enabled/disales the cmdbar - press @ to open the cmdbar
	HDIcon			= true ;		-- The HD Icon in the corner of screen (helps support the development HD Admin Commands)
	AutoPrompt		= false ;		-- This prompts all players to take a free copy of the model. Set to 'false' to disable.
	FreeAdmin		= false ;		-- Allows everyone in server to have the chosen admin. e.g.' FreeAdmin = "VIP" '. Set to False if not. You can not set to 'Owner'.
	NoticeSound		= 261082034 ;	-- Notification sound ID
	NoticeSoundVol	= 0.5 ;			-- How loud the notification sound is. Must be between 0 and 1.
	ErrorSound		= 138090596 ;	-- Error sound ID
	ErrorSoundVol	= 0.5 ;			-- How loud the error sound is. Must be between 0 and 1.
}																																																											;
-- If the platform is too slow and moveDelay is too fast, then the platform might not reach the destination in time.

hideDestinationBlocks = true --[[ If you set this to true, then the destination blocks will be hidden when you play.
Otherwise, set it to false if you want to see them.
------------------------------------------------------------------------------------------------------------------------------]]
-- Visualizes a ray. This will not run if FastCast.VisualizeCasts is false.
function DbgVisualizeSegment(castStartCFrame: CFrame, castLength: number): ConeHandleAdornment?
	--if ClientSettings.Debug.Value == false then return nil end
	if true then
		return
	end
	local adornment = Instance.new("CylinderHandleAdornment")
	adornment.Adornee = workspace.Terrain
	adornment.CFrame = castStartCFrame
	adornment.Height = castLength
	adornment.Color3 = Color3.new(1, 0, 0)
	adornment.Radius = 0.05
	adornment.Transparency = 0.5
	adornment.Parent = GetFastCastVisualizationContainer()
	Debris:AddItem(adornment, 3)
	return adornment
end
--Gauge
MakeWeld(car.Misc.Tach.M,car.DriveSeat,"Motor").Name="M"
ModelWeld(misc.Tach.Parts,misc.Tach.M)
MakeWeld(car.Misc.Speedo.N,car.DriveSeat,"Motor").Name="N"
ModelWeld(misc.Speedo.Parts,misc.Speedo.N)

car.DriveSeat.ChildAdded:connect(function(child)
	if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
		child.C0=CFrame.new(0,-.5,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0)*CFrame.Angles(math.rad(13),0,0)
	end
end)
--[[
	 Builds a map that allows us to find Attachment0/Attachment1 when we have the other,
		and keep track of the joint that connects them. Format is
		{
			["WaistRigAttachment"] = {
				Joint = UpperTorso.Waist<Motor6D>,
				Attachment0 = LowerTorso.WaistRigAttachment<Attachment>,
				Attachment1 = UpperToros.WaistRigAttachment<Attachment>,
			},
			...
		}
--]]
function buildAttachmentMap(character)
	local attachmentMap = {}
	
	-- NOTE: GetConnectedParts doesn't work until parts have been parented to Workspace, so
	-- we can't use it (unless we want to have that silly restriction for creating ragdolls)
	for _,part in pairs(character:GetChildren()) do
		if part:IsA("BasePart") then
			for _,attachment in pairs(part:GetChildren()) do
				if attachment:IsA("Attachment") then
					local jointName = attachment.Name:match("^(.+)RigAttachment$")
					local joint = jointName and attachment.Parent:FindFirstChild(jointName) or nil
					
					if joint then
						attachmentMap[attachment.Name] = {
							Joint = joint,
							Attachment0=joint.Part0[attachment.Name]; 
							Attachment1=joint.Part1[attachment.Name];
						}
					end
				end
			end
		end
	end
	
	return attachmentMap
end

return function(character)
	local humanoid = character:FindFirstChild("Humanoid")
	-- Trying to recover from broken joints is not fun. It's impossible to reattach things like
	-- armor and tools in a generic way that works across all games, so we just prevent that
	-- from happening in the first place.
	humanoid.BreakJointsOnDeath = false
	
	-- Roblox decided to make the ghost HumanoidRootPart CanCollide=true for some reason, so
	-- we correct this and disable collisions. This prevents the invisible part from colliding
	-- with the world and ruining the physics simulation (e.g preventing a roundish torso from
	-- rolling)
	local rootPart = character:FindFirstChild("HumanoidRootPart")
	if rootPart then
		rootPart.CanCollide = false
	end 

	local attachmentMap = buildAttachmentMap(character)
	local ragdollConstraints = buildConstraints(attachmentMap)
	local collisionFilters = buildCollisionFilters(attachmentMap, character.PrimaryPart)

	collisionFilters.Parent = ragdollConstraints
	ragdollConstraints.Parent = character
end
--
--
local Info = {
	-- These are constant values.  Don't change them unless you know what you're doing.

	-- Services
	Players = Game:GetService 'Players',
	PathfindingService = Game:GetService 'PathfindingService',

	-- Advanced settings
	RecomputePathFrequency = 1, -- The monster will recompute its path this many times per second
	RespawnWaitTime = 5, -- How long to wait before the monster respawns
	JumpCheckFrequency = 100, -- How many times per second it will do a jump check
}
local Data = {
	-- These are variable values used internally by the script.  Advanced users only.

	LastRecomputePath = 0,
	Recomputing = false, -- Reocmputing occurs async, meaning this script will still run while it's happening.  This variable will prevent the script from running two recomputes at once.
	PathCoords = {},
	IsDead = false,
	TimeOfDeath = 0,
	CurrentNode = nil,
	CurrentNodeIndex = 1,
	AutoRecompute = true,
	LastJumpCheck = 0,
	LastAttack = 0,
	
	BaseMonster = Self:Clone(),
	AttackTrack = nil,
}
-- Initialize the tool
local MeshTool = {

	Name = 'Mesh Tool';
	Color = BrickColor.new 'Bright violet';

};
-- Implement Signal:Wait() in terms of a temporary connection using
-- a Signal:Connect() which disconnects itself.
function Signal.Wait(self: ClassType)
	local waitingCoroutine = coroutine.running()
	local cn: SignalConnection
	cn = self:Connect(function(...: any?)
		cn:Disconnect()
		task.spawn(waitingCoroutine, ...)
	end)
	return coroutine.yield()
end

return Signal
-- services

local Workspace		= game:GetService("Workspace")
local Players		= game:GetService("Players")
local StarterGui	= game:GetService("StarterGui")
--[[
	This holds all the logic and user experience for the warmup user interface view.
]]
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local translate = require(ReplicatedStorage.Dependencies.GameUtils.TranslateUtils).translate

local Players = game.Players
local LocalPlayer = Players.LocalPlayer

local Warmup = {}

local elements = ReplicatedStorage.UIViews.Warmup
local activeElements
-- Private Methods

function init(self)
	local button = self.Button
	local listFrame = self.ListFrame
	
	local function contentSizeUpdate()
		local absSize = button.AbsoluteSize
		local ratio = absSize.y / absSize.x
		
		button.Arrow.Size = UDim2.new(ratio, 0, 1, 0)
		button.Option.Size = UDim2.new(1 - ratio, -12, 1, 0)
	end
	
	contentSizeUpdate()
	self._Maid:Mark(button:GetPropertyChangedSignal("AbsoluteSize"):Connect(contentSizeUpdate))
	
	for i, optionButton in next, listFrame.ScrollFrame:GetChildren() do
		self._Options[i] = optionButton
		optionButton.Activated:Connect(function()
			self:Set(optionButton)
		end)
	end

	self._Maid:Mark(button.Activated:Connect(function()
		self:Show(not listFrame.Visible)
	end))
	
	self._Maid:Mark(UIS.InputBegan:Connect(function(input)
		if (VALID_PRESS[input.UserInputType]) then
			local p = input.Position
			local p2 = Vector2.new(p.x, p.y)
			
			if (listFrame.Visible and not (isInFrame(listFrame, p2) or isInFrame(button, p2))) then
				self:Show(false)
			end
		end
	end))
end

function isInFrame(frame, pos)
	local fPos = frame.AbsolutePosition
	local fSize = frame.AbsoluteSize
	local d = pos - fPos
	return (d.x >= 0 and d.x <= fSize.x and d.y >= 0 and d.y <= fSize.y)
end
----- Initialize -----

for _, player in ipairs(Players:GetPlayers()) do
	PlayerReference[player] = true
end

RateLimiter.Default = RateLimiter.NewRateLimiter(SETTINGS.DefaultRateLimiterRate)
-- Mounts the provided humanoid into the look-angle
-- update system, binding all of its current and
-- future Motor6D joints into the rotator.

function CharacterRealism:MountLookAngle(humanoid)	
	local character = humanoid.Parent
	local rotator = character and self.Rotators[character]
	
	if not rotator then
		-- Create a rotator for this character.
		rotator = 
		{
			Motors = {};
			
			Pitch =
			{
				Goal = 0;
				Current = 0;
			};

			Yaw =
			{
				Goal = 0;
				Current = 0;
			};
		}
		
		-- If this is our character, the rotation 
		-- values should not be interpolated while 
		-- the client is in first person.
		
		local player = Players:GetPlayerFromCharacter(character)
		
		if player == self.Player then
			rotator.SnapFirstPerson = true
		end
		
		-- Register this rotator for the character.
		self.Rotators[character] = rotator
		
		-- Record all existing Motor6D joints
		-- and begin recording newly added ones.
		
		local function onDescendantAdded(desc)
			if desc:IsA("Motor6D") then
				self:AddMotor(rotator, desc)
			end
		end
		
		for _,desc in pairs(character:GetDescendants()) do
			onDescendantAdded(desc)
		end
		
		rotator.Listener = character.DescendantAdded:Connect(onDescendantAdded)
	end
	
	return rotator
end
-- This function casts a ray with a whitelist.
local function CastWithWhitelist(origin, direction, whitelist, ignoreWater)
	if not whitelist or typeof(whitelist) ~= "table" then
		-- This array is faulty.
		error("Call in CastWhitelist failed! Whitelist table is either nil, or is not actually a table.", 0)
	end
	local castRay = Ray.new(origin, direction)
	-- Now here's something bizarre: FindPartOnRay and FindPartOnRayWithIgnoreList have a "terrainCellsAreCubes" boolean before ignoreWater. FindPartOnRayWithWhitelist, on the other hand, does not!
	return Workspace:FindPartOnRayWithWhitelist(castRay, whitelist, ignoreWater)
end