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





function findAllFlagStands(root)
	local c = root:children()
	for i=1,#c do
		if (c[i].className == "Model" or c[i].className == "Part") then
			findAllFlagStands(c[i])
		end
		if (c[i].className == "FlagStand") then
			table.insert(stands, c[i])
		end
	end
end

function hookUpListeners()
	for i=1,#stands do
		stands[i].FlagCaptured:connect(onCaptureScored)
	end
end

function onPlayerEntered(newPlayer)

	if CTF_mode == true then

		local stats = Instance.new("Folder")
		stats.Name = "leaderstats"

		local captures = Instance.new("IntValue")
		captures.Name = "Captures"
		captures.Value = 0


		captures.Parent = stats

		-- VERY UGLY HACK
		-- Will this leak threads?
		-- Is the problem even what I think it is (player arrived before character)?
		while true do
			if newPlayer.Character ~= nil then break end
			wait(5)
		end

		stats.Parent = newPlayer

	else

		local stats = Instance.new("Folder")
		stats.Name = "leaderstats"
		local kills = false
		if Settings.LeaderboardSettings.KOs then
			kills = Instance.new("IntValue")
			kills.Name = Settings.LeaderboardSettings.KillsName
			kills.Value = 0
		end
		local deaths = false
		if Settings.LeaderboardSettings.WOs then
			deaths = Instance.new("IntValue")
			deaths.Name = Settings.LeaderboardSettings.DeathsName
			deaths.Value = 0
		end
		
		local cash = false
		if Settings.LeaderboardSettings.ShowCurrency then
			cash = Instance.new("IntValue")
			cash.Name = Settings.CurrencyName
			cash.Value = 0
		end
		
		local PlayerStats = game.ServerStorage.PlayerMoney:FindFirstChild(newPlayer.Name)
		if PlayerStats ~= nil then
			if cash then
				local Short = Settings.LeaderboardSettings.ShowShortCurrency
				PlayerStats.Changed:connect(function()
					if (Short) then
						cash.Value = Settings:ConvertShort(PlayerStats.Value)
					else
						cash.Value = Settings:ConvertComma(PlayerStats.Value)
					end
				end)
			end
		end
		if kills then
		kills.Parent = stats
		end
		if deaths then
		deaths.Parent = stats
		end
		if cash then
		cash.Parent = stats
		end

		-- VERY UGLY HACK
		-- Will this leak threads?
		-- Is the problem even what I think it is (player arrived before character)?
		while true do
			if newPlayer.Character ~= nil then break end
			wait(5)
		end

		local humanoid = newPlayer.Character.Humanoid

		humanoid.Died:connect(function() onHumanoidDied(humanoid, newPlayer) end )

		-- start to listen for new humanoid
		newPlayer.Changed:connect(function(property) onPlayerRespawn(property, newPlayer) end )


		stats.Parent = newPlayer

	end

end


function onCaptureScored(player)

		local ls = player:findFirstChild("leaderstats")
		if ls == nil then return end
		local caps = ls:findFirstChild("Captures")
		if caps == nil then return end
		caps.Value = caps.Value + 1

end


findAllFlagStands(game.Workspace)
hookUpListeners()
if (#stands > 0) then CTF_mode = true end
game.Players.ChildAdded:connect(onPlayerEntered)
---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- 
-- Put in StarterGui -- 					
--	--	--	--	--	--	--	--	--	--	--	--	--	--	--	--	--	--	--
--	Place this into StarterGui or StarterPack							--
--	CREDIT																--
--	WhoBloxxedWho; for the initial script								--
--	DoogleFox; some stuff ripped from his panner script					--
--	DuruTeru; shoving it all into this script and then some :)			--
--	UPDATE: turned it into r15, made it so you can swim right in water	--
--	--	--	--	--	--	--	--	--	--	--	--	--	--	--	--	--	--	--
--[[
	This view holds all the logic and user experience for the dead user interface view.
]]


local ReplicatedStorage = game:GetService("ReplicatedStorage")
local SoundService = game:GetService("SoundService")

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

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

local Dead = {}

local elements = ReplicatedStorage.UIViews.Keyboard.Dead
local sounds = ReplicatedStorage.SFX.NonDiagetic
local activeElements

local failSound = sounds.Fail:Clone()
failSound.Parent = SoundService
--[[
Listing	- добавленные сообщения для вывода на экран
	alert - Date/Time создания алерта
		текст		- обязательный элемент! 
		цвет текста	- может отсутствовать (белый по умолчанию)
		картинка	- может отсутствовать (текст на всё поле)
		таймер		- уменьшается в размерах пропорционально отведённому времени (по умолчанию 5 сек)
		
Core	- основной клиентский скрипт
	Вывод должен следовать один за другим
	при уменьшении предыдущих, последующие смещаются вверх
	по достижении минимального размера 0 удаляются
]]



local sg = script.Parent 						--Surface GUI
local dm = script:WaitForChild("DestroyMe")		-- скрипт самоуничтожения
local ls = sg:WaitForChild("Listing")			-- список алертов для вывода
local sf = sg:WaitForChild("ScrollingFrame")	--The scrolling frame
sf.Visible = true
local sm = sf:WaitForChild("Sample")			--Our Sample frame
local ui = sf:WaitForChild("UI") 				--The UI list layout
--[[ SCRIPT VARIABLES ]]


local CHAT_BUBBLE_FONT = Enum.Font.Fantasy
local CHAT_BUBBLE_FONT_SIZE = Enum.FontSize.Size24 -- if you change CHAT_BUBBLE_FONT_SIZE_INT please change this to match
local CHAT_BUBBLE_FONT_SIZE_INT = 24 -- if you change CHAT_BUBBLE_FONT_SIZE please change this to match
local CHAT_BUBBLE_LINE_HEIGHT = CHAT_BUBBLE_FONT_SIZE_INT + 10
local CHAT_BUBBLE_TAIL_HEIGHT = 14
local CHAT_BUBBLE_WIDTH_PADDING = 30
local CHAT_BUBBLE_FADE_SPEED = 1.5

local BILLBOARD_MAX_WIDTH = 400
local BILLBOARD_MAX_HEIGHT = 250	--This limits the number of bubble chats that you see above characters

local ELIPSES = "..."
local MaxChatMessageLength = 128 -- max chat message length, including null terminator and elipses.
local MaxChatMessageLengthExclusive = MaxChatMessageLength - getMessageLength(ELIPSES) - 1

local NEAR_BUBBLE_DISTANCE = 65	--previously 45
local MAX_BUBBLE_DISTANCE = 100	--previously 80
-- Setup the default levels


Log.SetupLevel('Info', 1)
Log.SetupLevel('Debug', 2)
Log.SetupLevel('Warn', 3)
Log.SetupLevel('Error', 4)

function Log.Log(level, chan, ...)
	local msg = string.format(...)
	local levelName = Log._LevelName[level]

	if _messageQueue then
		if not _remoteFilterFunc or not _remoteFilterFunc(level, levelName, chan, msg) then
			table.insert(_messageQueue, {tick(), level, chan, msg})
		end
	end

	if _consoleFilterFunc and _consoleFilterFunc(level, levelName, chan, msg) then
		return;
	end

	if chan then
		print(string.format("[%s][%s]", levelName, chan), msg)
	else
		print(string.format("[%s]", levelName), msg)
	end
end

Log.Data =
	setmetatable({}, {
			__index = function(tbl, key)
				return function(...)
					Log.LogData(key, ...)
				end
			end;
	})

function Log.LogData(chan, data)
	if _messageQueue then
		table.insert(_messageQueue, {tick(), 'data', chan, data})
	end
end

function Log.ProcessQueue(remote)
	if not _messageQueue then
		return
	end

	-- As a naive first pass, let's just send all of it at once.

	if _isClient then
		_remoteEvent:FireServer(_messageQueue)

	elseif remote and #_messageQueue > 0 then
		-- TODO:  Count connection errors and stop attempting remote connections if it can't be reached
		-- .Experiment with compression
		local data = {
			place = game.PlaceId,
			game = game.GameId,
			job = game.JobId,
			messages = _messageQueue,
		}

		HttpService:PostAsync(remote,
							  HttpService:JSONEncode(data),
							  Enum.HttpContentType.ApplicationJson,
							  false)
	end

	Log.ClearQueue()
end

local function onClientLogging(player, messages)
	if _messageQueue and #messages > 0 then
		table.insert(_messageQueue, {player = player.UserId, messages = messages })
	end
end

function Log.wrapSystemMessages()
	LogService.MessageOut:connect(function(msg, msgType)
			-- HACK:  Have to detect our logging messages vs. system level ones
			if string.match(msg, '^%[[^%]]+%]') then
				return
			end

			-- NOTE:  +1 more or less automatically maps to the current built-in log levels
			Log.Log(msgType.Value + 1, 'SYSTEM', "%s", msg)
	end)
end

function Log.EnableQueue(state)
	if state and not _messageQueue then
		_messageQueue = {}
	end

	if not state then
		_messageQueue = nil
	end
end

function Log.ClearQueue()
	for k,v in pairs(_messageQueue) do
		_messageQueue[k] = nil
	end
end

function Log.SetRemoteFilterFunc(func)
	_remoteFilterFunc = func
end

function Log.SetConsoleFilterFunc(func)
	_consoleFilterFunc = func
end

local function _remoteFilterEverything()
	return true
end
--[[
cspeed = speed/1.298
print("FL ".. math.abs(FL.Parent.RotVelocity.Magnitude-cspeed))
print("FR ".. math.abs(FR.Parent.RotVelocity.Magnitude-cspeed))
print("RL ".. math.abs(RL.Parent.RotVelocity.Magnitude-cspeed))
print("RR ".. math.abs(RR.Parent.RotVelocity.Magnitude-cspeed))]]--
--print("Speed ".. speed/1.298)


bST = (inds.Value)*(1000*convert)  
build = rpm.Value/18000


if speed > 110 and carSeat.Steer ~= 0 then
--///////////////// Internal-Use Methods
--//////////////////////////////////////


function methods:InternalDestroy()
	for i, channel in pairs(self.Channels) do
		channel:InternalRemoveSpeaker(self)
	end

	self.eDestroyed:Fire()

	self.eDestroyed:Destroy()
	self.eSaidMessage:Destroy()
	self.eReceivedMessage:Destroy()
	self.eReceivedUnfilteredMessage:Destroy()
	self.eMessageDoneFiltering:Destroy()
	self.eReceivedSystemMessage:Destroy()
	self.eChannelJoined:Destroy()
	self.eChannelLeft:Destroy()
	self.eMuted:Destroy()
	self.eUnmuted:Destroy()
	self.eExtraDataUpdated:Destroy()
	self.eMainChannelSet:Destroy()
	self.eChannelNameColorUpdated:Destroy()
end

function methods:InternalAssignPlayerObject(playerObj)
	self.PlayerObj = playerObj
end

function methods:InternalSendMessage(messageObj, channelName)
	local success, err = pcall(function()
		self.eReceivedUnfilteredMessage:Fire(messageObj, channelName)
	end)
	if not success and err then
		print("Error sending internal message: " ..err)
	end
end

function methods:InternalSendFilteredMessage(messageObj, channelName)
	local success, err = pcall(function()
		self.eReceivedMessage:Fire(messageObj, channelName)
		self.eMessageDoneFiltering:Fire(messageObj, channelName)
	end)
	if not success and err then
		print("Error sending internal filtered message: " ..err)
	end
end
--FL


fSprings[1].Thickness = Settings[1]
fSprings[1].MaxLength = Settings[2]
fSprings[1].MinLength = Settings[3]
fSprings[1].Damping = Settings[4]
fSprings[1].FreeLength = Settings[5]
fSprings[1].LimitsEnabled = Settings[6]
fSprings[1].MaxForce = Settings[7]
fSprings[1].Stiffness = Settings[8]
-- Preload animations


function playAnimation(animName, transitionTime, humanoid)
	if (animName ~= currentAnim) then		 
		
		if (oldAnimTrack ~= nil) then
			oldAnimTrack:Stop()
			oldAnimTrack:Destroy()
		end

		currentAnimSpeed = 1.0
		local roll = math.random(1, animTable[animName].totalWeight) 
		local origRoll = roll
		local idx = 1
		while (roll > animTable[animName][idx].weight) do
			roll = roll - animTable[animName][idx].weight
			idx = idx + 1
		end
--Precalculated paths


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



local START = game.Workspace.Start
START:SetPrimaryPartCFrame(CFrame.new(0,0,110))

while true  do
	PartWorld = script.Parts.Value
	
	if PartWorld ~= 0 then
		
		-- для всех игроков установить базовую точку старта
		local tmp = game.Players:GetChildren()
		for a, b in pairs(tmp) do
			b.RespawnLocation = START.SpawnLocation
		end
		
		-- удалить старый путь
		tmp = game.Workspace.GameZone:GetChildren()
		for a, b in pairs(tmp) do
			b:Destroy()
		end
		wait(5)	-- чтобы игрок успел упасть на дно 
		
		-- создать новый путь
		tmp = Rebuild()
		
		RebuildWorld = 300
		wait(RebuildWorld)	-- ждём указанное время
	else
		wait(1)
	end
end
--[[
	Enqueues an instance property to be updated next render step.
]]


function Scheduler.enqueueProperty(instance: Instance, propertyName: string, newValue: any)
	willUpdate = true

	-- we can't iterate over nil values of tables, so use a symbol instead
	if newValue == nil then
		newValue = None
	end

	local propertyTable = propertyChanges[instance]
	if propertyTable == nil then
		propertyChanges[instance] = {
			[propertyName] = newValue
		}
	else
		propertyTable[propertyName] = newValue
	end
end
-- Function to call on renderstepped. Orients the character so it is facing towards
-- the player mouse's position in world space. If character is sitting then the torso
-- should not track


local function frame(mousePosition)
	-- Special mobile consideration. We don't want to track if the user was touching a ui
	-- element such as the movement controls. Just return out of function if so to make sure
	-- character doesn't track
	if not mobileShouldTrack then return end
	
	--This math is completely wrong with R15. We're better off just not doing it at all
	if player.Character.Humanoid.RigType == Enum.HumanoidRigType.R15 then
		return
	end
	
	-- Make sure character isn't swiming. If the character is swimming the following code will
	-- not work well; the character will not swim correctly. Besides, who shoots underwater?
	if player.Character.Humanoid:GetState() ~= Enum.HumanoidStateType.Swimming then
		local torso = player.Character.HumanoidRootPart
		local head = player.Character.Head
		
		local toMouse = (mousePosition - head.Position).unit
		local angle = math.acos(toMouse:Dot(Vector3.new(0,1,0)))
		
		local neckAngle = angle
	
		-- Limit how much the head can tilt down. Too far and the head looks unnatural
		if math.deg(neckAngle) > 110 then
			neckAngle = math.rad(110)
		end
		neck.C0 = CFrame.new(0,1,0) * CFrame.Angles(math.pi - neckAngle,math.pi,0)
		
		-- Calculate horizontal rotation
		local arm do
			arm = player.Character:FindFirstChild("Right Arm") or
				  player.Character:FindFirstChild("RightUpperArm")
		end
		local fromArmPos = torso.Position + torso.CFrame:vectorToWorldSpace(Vector3.new(
			torso.Size.X/2 + arm.Size.X/2, torso.Size.Y/2 - arm.Size.Z/2, 0))
		local toMouseArm = ((mousePosition - fromArmPos) * Vector3.new(1,0,1)).unit
		local look = (torso.CFrame.lookVector * Vector3.new(1,0,1)).unit
		local lateralAngle = math.acos(toMouseArm:Dot(look))		
		
		-- Check for rogue math
		if tostring(lateralAngle) == "-1.#IND" then
			lateralAngle = 0
		end		
		
		-- Handle case where character is sitting down
		if player.Character.Humanoid:GetState() == Enum.HumanoidStateType.Seated then			
			
			local cross = torso.CFrame.lookVector:Cross(toMouseArm)
			if lateralAngle > math.pi/2 then
				lateralAngle = math.pi/2
			end
			if cross.Y < 0 then
				lateralAngle = -lateralAngle
			end
		end	
		
		-- Turn shoulder to point to mouse
		shoulder.C0 = CFrame.new(1,0.5,0) * CFrame.Angles(math.pi/2 - angle,math.pi/2 + lateralAngle,0)	
		
		-- If not sitting then aim torso laterally towards mouse
		if not amISitting(player.Character) then
			torso.CFrame = CFrame.new(torso.Position, torso.Position + (Vector3.new(
				mousePosition.X, torso.Position.Y, mousePosition.Z)-torso.Position).unit)
		end	
	end
end
--Char.Humanoid.BreakJointsOnDeath = false



if configuracao.EnableRagdoll == true then
	if human.Health <= 1 then
		Ragdoll(Char)
	end
end


human.HealthChanged:Connect(function (newhealth)
		if dead.Value == false and Sang.Value >= 10 then
		
		
			human.Health = math.clamp(newhealth, 0.1, 100)
		
		if newhealth <= 0.1 or human.Health <= 0.1 then
			Caido.Value = true
		end
	
		if (rodeath.Value == true or life.Value == false) and newhealth <= -25 then
			local loss = newhealth * 40
			Sang.Value = Sang.Value + loss
			human.PlatformStand = true
			human.AutoRotate = false	
			Caido.Value = true	
	
		end
		
			
		
		else
			human.PlatformStand = false
		human.AutoRotate = true
			
			human.Health = 0
			
		end
end)
------------------------------------------------------------------------
-- * l1 was a pointer, now l1 is returned and callee assigns the value
-- * used in multiple locations
------------------------------------------------------------------------


function luaK:concat(fs, l1, l2)
  if l2 == self.NO_JUMP then return l1
  elseif l1 == self.NO_JUMP then
    return l2
  else
    local list = l1
    local _next = self:getjump(fs, list)
    while _next ~= self.NO_JUMP do  -- find last element
      list = _next
      _next = self:getjump(fs, list)
    end
    self:fixjump(fs, list, l2)
  end
  return l1
end
--[[
	Proxy layer between the player FSM and the player state scripts, allowing debug and player state updates to be fired.

	When a state is entered, the updateStatus function is called for the relevant ServerPlayerComponent
]]


local ServerStorage = game:GetService("ServerStorage")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Logger = require(ReplicatedStorage.Dependencies.GameUtils.Logger)

local PlayerPreGame = require(ServerStorage.Source.GameStates.Player.PlayerPreGame)
local PlayerWarmup = require(ServerStorage.Source.GameStates.Player.PlayerWarmup)
local PlayerGame = require(ServerStorage.Source.GameStates.Player.PlayerGame)
local PlayerPostGame = require(ServerStorage.Source.GameStates.Player.PlayerPostGame)
local PlayerFinished = require(ServerStorage.Source.GameStates.Player.PlayerFinished)
local PlayerDead = require(ServerStorage.Source.GameStates.Player.PlayerDead)
local PlayerSpectating = require(ServerStorage.Source.GameStates.Player.PlayerSpectating)

local Transitions = {}
--Put me in StarterCharacterScripts


local player = game.Players.LocalPlayer
local character = workspace:WaitForChild(player.Character.Name)
local camera = workspace.CurrentCamera
local running = false
local speed = character.Humanoid.WalkSpeed / 2
local RunService = game:GetService("RunService")
local Pi = 3.1415926
local Rot = 3.1415926 / 2

character.Humanoid.Running:Connect(function(WalkSpeed)
	if WalkSpeed > 0.1 then
		running = true
	else
		running = false
	end
end)

while true do
	RunService.RenderStepped:wait()
	fps = (camera.CoordinateFrame.p - character.Head.Position).Magnitude
	if running == true then
		Rot = Rot + character.Humanoid.WalkSpeed / 115
	end
	if Rot >= Pi * 2 then
		Rot = 0
	end
	camera.CoordinateFrame = camera.CoordinateFrame * CFrame.new(math.cos(Rot) / speed, math.sin(Rot * 2) / (speed * 2), 0) * CFrame.Angles(0, 0, math.sin(Rot - Pi * 1.5) / (speed * 20))
end
--[[ The Module ]]

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

function Invisicam.new()
	local self = setmetatable(BaseOcclusion.new(), Invisicam)
	
	self.char = nil
	self.humanoidRootPart = nil
	self.torsoPart = nil
	self.headPart = nil
	
	self.childAddedConn = nil
	self.childRemovedConn = nil
	
	self.behaviors = {} 	-- Map of modes to behavior fns
	self.behaviors[MODE.LIMBS] = self.LimbBehavior
	self.behaviors[MODE.MOVEMENT] = self.MoveBehavior
	self.behaviors[MODE.CORNERS] = self.CornerBehavior
	self.behaviors[MODE.CIRCLE1] = self.CircleBehavior
	self.behaviors[MODE.CIRCLE2] = self.CircleBehavior
	self.behaviors[MODE.LIMBMOVE] = self.LimbMoveBehavior
	self.behaviors[MODE.SMART_CIRCLE] = self.SmartCircleBehavior
	self.behaviors[MODE.CHAR_OUTLINE] = self.CharacterOutlineBehavior	
	
	self.mode = MODE.SMART_CIRCLE
	self.behaviorFunction = self.SmartCircleBehavior
	
	
	self.savedHits = {} 	-- Objects currently being faded in/out
	self.trackedLimbs = {}	-- Used in limb-tracking casting modes
		
	self.camera = game.Workspace.CurrentCamera

	self.enabled = false
	return self
end

function Invisicam:Enable(enable)
	self.enabled = enable
	
	if not enable then
		self:Cleanup()
	end
end

function Invisicam:GetOcclusionMode()
	return Enum.DevCameraOcclusionMode.Invisicam
end
--Returns the character and humanoid of a descendants.


local function FindCharacterAncestor(Ins)
	if Ins and Ins ~= game.Workspace then
		local Humanoid = Ins:FindFirstChildOfClass("Humanoid")
		if Humanoid then
			return Ins,Humanoid
		else
			return FindCharacterAncestor(Ins.Parent)
		end
	end
end
--[=[
	@class Input

	The Input module provides access to various user input classes.

	- [PreferredInput](/api/PreferredInput)
	- [Mouse](/api/Mouse)
	- [Keyboard](/api/Keyboard)
	- [Touch](/api/Touch)

	```lua
	local Input = require(packages.Input)

	local PreferredInput = Input.PreferredInput
	local Mouse = Input.Mouse
	local Keyboard = Input.Keyboard
	local Touch = Input.Touch
	```
]=]


local Input = {
	PreferredInput = require(script.PreferredInput);
	Mouse = require(script.Mouse);
	Keyboard = require(script.Keyboard);
	Touch = require(script.Touch);
}

return Input