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


local game = game
local workspace = workspace
local pcall = pcall
local unpack = unpack
local next = next
local tick = tick
local ipairs = ipairs
local script = script
local tostring = tostring
local type = type
local typeof = typeof
local Instance_new = Instance.new
local drag, SelectionVar
local UDim2_new = UDim2.new
local Vector2_new = Vector2.new
local Vector3_new = Vector3.new
local CFrame_new = CFrame.new
local NumberRange_new = NumberRange.new
local Color3_new = Color3.new
local Color3_fromRGB = Color3.fromRGB
local table_insert = table.insert
local table_remove = table.remove
local table_sort = table.sort
local table_concat = table.concat
local table_clear = table.clear
local string_split = string.split
local string_find = string.find
local string_match = string.match
local string_lower = string.lower
local string_sub = string.sub
local string_byte = string.byte
local string_gsub = string.gsub
local string_rep = string.rep
local math_floor = math.floor
local math_ceil = math.ceil
local math_random = math.random
local math_huge = math.huge
local Option = {
	-- can modify object parents in the hierarchy
	Modifiable = false;
	-- can select objects
	Selectable = true;
}
-- Made by Crozur


script.Parent.BillboardGui.Enabled = false

game.Players.PlayerAdded:Connect(function(plr)
	if plr.Name == ("Owner Of Game") then -- Insert your name in between the ""
		wait(3) -- waits just in case player isn't loaded
		script.Parent.BillboardGui.Enabled = true -- makes it visible
		script.Parent.BillboardGui.Parent = plr.Character.Head -- Puts the title above your head, you can change the offset under BillboardGui.StudsOffset
	end
end)
-- register what control scripts we are using


do
	local PlayerScripts = LocalPlayer:WaitForChild("PlayerScripts")
	local canRegisterControls = pcall(function() PlayerScripts:RegisterTouchMovementMode(Enum.TouchMovementMode.Default) end)

	if canRegisterControls then
		PlayerScripts:RegisterTouchMovementMode(Enum.TouchMovementMode.Thumbstick)
		PlayerScripts:RegisterTouchMovementMode(Enum.TouchMovementMode.DPad)
		PlayerScripts:RegisterTouchMovementMode(Enum.TouchMovementMode.Thumbpad)
		PlayerScripts:RegisterTouchMovementMode(Enum.TouchMovementMode.ClickToMove)
		PlayerScripts:RegisterTouchMovementMode(Enum.TouchMovementMode.DynamicThumbstick)

		PlayerScripts:RegisterComputerMovementMode(Enum.ComputerMovementMode.Default)
		PlayerScripts:RegisterComputerMovementMode(Enum.ComputerMovementMode.KeyboardMouse)
		PlayerScripts:RegisterComputerMovementMode(Enum.ComputerMovementMode.ClickToMove)
	end
end

local DynamicThumbstickAvailable = pcall(function() 
	return Enum.DevTouchMovementMode.DynamicThumbstick and Enum.TouchMovementMode.DynamicThumbstick
end)

local FFlagUserNoCameraClickToMoveSuccess, FFlagUserNoCameraClickToMoveResult = pcall(function() return UserSettings():IsUserFeatureEnabled("UserNoCameraClickToMove") end)
local FFlagUserNoCameraClickToMove = FFlagUserNoCameraClickToMoveSuccess and FFlagUserNoCameraClickToMoveResult
--Settings localized


local Fade = Random_:NextNumber(1,1.5)
local fadeInfo = TweenInfo.new(Fade, Enum.EasingStyle.Sine, Enum.EasingDirection.In)
local strechInfo = TweenInfo.new(Fade / 1.05, Enum.EasingStyle.Quint, Enum.EasingDirection.In)
local fadeGoal = {Transparency = 1}
-------------------------


function onClicked()
R.Function1.Disabled = true
FX.HPF.BrickColor = BrickColor.new("Really red")
FX.HPF.loop.Disabled = true

FX.JET.BrickColor = BrickColor.new("Really red")
FX.JET.loop.Disabled = true

FX.LPF.BrickColor = BrickColor.new("Really red")
FX.LPF.loop.Disabled = true

FX.NOISE.BrickColor = BrickColor.new("Really red")
FX.NOISE.loop.Disabled = true

FX.ZIP.BrickColor = BrickColor.new("Really red")
FX.ZIP.loop.Disabled = true
R.loop.Disabled = false
R.Function2.Disabled = false
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
-------- OMG HAX



r = game:service("RunService")


local damage = 100


local slash_damage = 100
local lunge_damage = 100

sword = script.Parent.Handle
Tool = script.Parent


local SlashSound = sword.SoundSlash

local UnsheathSound = sword.SoundUnsheath

function getHumanoid(obj)
	local get = obj:getChildren()
	for i=1, #get do
		if get[i].className == "Humanoid" then
			return get[i]
		end
	end
	return nil
end

function blow(hit)
	if (hit.Parent == nil) then return end -- happens when bullet hits sword

	local humanoid = getHumanoid(hit.Parent)
	local vCharacter = Tool.Parent
	local vPlayer = game.Players:playerFromCharacter(vCharacter)
	local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
	if humanoid~=nil and humanoid ~= hum and hum ~= nil then
		-- final check, make sure sword is in-hand

		local right_arm = vCharacter:FindFirstChild("Right Arm")
		if (right_arm ~= nil) then
			local joint = right_arm:FindFirstChild("RightGrip")
			if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
				tagHumanoid(humanoid, vPlayer)
				humanoid:TakeDamage(damage)
				wait(1)
				untagHumanoid(humanoid)
			end
		end


	end
end


function tagHumanoid(humanoid, player)
	local creator_tag = Instance.new("ObjectValue")
	creator_tag.Value = player
	creator_tag.Name = "creator"
	creator_tag.Parent = humanoid
end

function untagHumanoid(humanoid)
	if humanoid ~= nil then
		local tag = humanoid:findFirstChild("creator")
		if tag ~= nil then
			tag.Parent = nil
		end
	end
end


function attack()
	damage = slash_damage
	SlashSound:play()
	local anim = Instance.new("StringValue")
	anim.Name = "toolanim"
	anim.Value = "Slash"
	anim.Parent = Tool
end

function fire(pos)
	local bullet =script.Parent.Handle:clone()
	bullet.CFrame = CFrame.new(Tool.Parent.Head.Position + (pos - Tool.Parent.Head.Position).unit * 6, pos)
	bullet.CanCollide = true
	bullet.Name = "Projectile"

	local velo = Instance.new("BodyVelocity")
	velo.velocity = (pos - Tool.Parent.Head.Position).unit * 100
	velo.Parent = bullet
	
	local spin = Instance.new("BodyAngularVelocity")
	spin.angularvelocity = bullet.CFrame:vectorToWorldSpace(Vector3.new(0,15,0))
	spin.Parent = bullet

	local newscript = script.Parent.ProjectileScript:clone()
	newscript.Disabled = false
	newscript.Parent = bullet
	
	local player = game.Players:findFirstChild(Tool.Parent.Name)
	if player == nil then return end
	tagHumanoid(bullet, player)

	bullet.Parent = workspace
end
	
function swordAcross()
	-- parry
end


Tool.Enabled = true
local last_attack = 0
function onActivated(mouse)

	if not Tool.Enabled then
		return
	end

	Tool.Enabled = false

	local character = Tool.Parent;
	local humanoid = character.Humanoid
	if humanoid == nil then
		print("Humanoid not found")
		return 
	end

	t = r.Stepped:wait()

	attack()
	fire(humanoid.TargetPoint)

	--wait(.5)

	Tool.Enabled = true
end


function onEquipped(mouse)
	UnsheathSound:play()
end


script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)


connection = sword.Touched:connect(blow)
---------------------------------------------------------------


function onChildAdded(child)
	if child.Name == "SeatWeld" then
		local human = child.part1.Parent:findFirstChild("Humanoid") 
		if (human ~= nil) then
			print("Human IN")
			seat.SirenControl.CarName.Value = human.Parent.Name.."'s Car"
			seat.Parent.Name = human.Parent.Name.."'s Car"
			s.Parent.SirenControl:clone().Parent = game.Players:findFirstChild(human.Parent.Name).PlayerGui
			seat.Start:Play()
			seat.Engine:Play()
			wait(3.07)
			seat.Start:Stop()
		end
	end
end

function onChildRemoved(child)
	if (child.Name == "SeatWeld") then	
		local human = child.part1.Parent:findFirstChild("Humanoid") 
		if (human ~= nil) then
			print("Human OUT")
			seat.Parent.Name = "PoliceCharger"
			seat.SirenControl.CarName.Value = "PoliceCharger"
			game.Players:findFirstChild(human.Parent.Name).PlayerGui.SirenControl:remove()
			seat.Engine:Stop()
		end
	end
end


script.Parent.ChildAdded:connect(onChildAdded)
script.Parent.ChildRemoved:connect(onChildRemoved)
--//ENGINE//--


Horsepower = 140  --{This is how much power your engine block makes ALONE, this does not represent to total horsepower output [IF you have a turbo/SC]}
EngineDisplacement = 3200 --{Engine size in CC's}
EngineType =  "Diesel" --{Petrol, Diesel, Electric]
EngineLocation = "Front" --{Front, Mid, Rear}
ForcedInduction = "Natural" --{Natural, Single, Twin, Supercharger} 
InductionPartSize = 0 --{0-5, 1 being small, 5 being large (Decimals accepted, e.g 2.64 turbo size, this is the size of the turbo}
ElectronicallyLimited = false --{Electronically Limit the top speed of your vehicle}
LimitSpeedValue = 200 --{Limits top speed of the vehicle [In MPH]}
-- You may turn both of these on at once. In that case, zone-specific music will play in the appropriate zones, and global background music will play whenever you're not within any zone.



	
settings.DisplayMuteButton = false  -- If set to true, there will be a button in the bottom-right corner of the screen allowing players to mute the background music.
	
settings.MusicFadeoutTime = 3  -- How long music takes to fade out, in seconds.

settings.MusicOnlyPlaysWithinZones = false  -- (This setting only applies when UseGlobalBackgroundMusic is set to false) If a player walks into an area that's not covered by any music zone, what should happen? If true, music will stop playing. If false, the music from the previous zone will continue to play.

return settings
--[=[
	@param predicate (player: Player, argsFromFire: ...) -> boolean
	@param ... any -- Arguments to pass to the clients (and to the predicate)
	Fires the signal at any clients that pass the `predicate`
	function test. This can be used to fire signals with much
	more control logic.

	:::note Outbound Middleware
	All arguments pass through any outbound middleware before being
	sent to the clients.
	:::

	:::caution Predicate Before Middleware
	The arguments sent to the predicate are sent _before_ getting
	transformed by any middleware.
	:::

	```lua
	-- Fire signal to players of the same team:
	remoteSignal:FireFilter(function(player)
		return player.Team.Name == "Best Team"
	end)
	```
]=]


function RemoteSignal:FireFilter(predicate: (Player, ...any) -> boolean, ...: any)
	for _,player in ipairs(Players:GetPlayers()) do
		if predicate(player, ...) then
			self._re:FireClient(player, self:_processOutboundMiddleware(nil, ...))
		end
	end
end
-- Left Legs


character.RagdollRig.ConstraintLeftUpperLeg.Attachment0 = LUL
character.RagdollRig.ConstraintLeftUpperLeg.Attachment1 = LULRig
character.RagdollRig.ConstraintLeftLowerLeg.Attachment0 = LLL
character.RagdollRig.ConstraintLeftLowerLeg.Attachment1 = LLLRig
character.RagdollRig.ConstraintLeftFoot.Attachment0 = LF
character.RagdollRig.ConstraintLeftFoot.Attachment1 = LFRig
-- Calculate label length


local LABEL_TEXT = 'ALT'
local LABEL_LENGTH = TextService:GetTextSize(LABEL_TEXT,
    21/2, Enum.Font.SourceSansSemibold, Vector2.new(math.huge, math.huge)).X

local function ScopeInTooltip(props)
    return new('ImageLabel', {
        BackgroundTransparency = 1;
        ImageTransparency = 1 - 0.14;
        Image = 'rbxassetid://4445959523';
        ScaleType = Enum.ScaleType.Slice;
        SliceCenter = Rect.new(4, 4, 12, 12);
        ImageColor3 = Color3.fromRGB(0, 0, 0);
        Size = UDim2.new(0, LABEL_LENGTH + 8/2, 0, 30/2);
        LayoutOrder = props.LayoutOrder or 3;
    },
    {
        Label = new('TextLabel', {
            BackgroundTransparency = 1;
            Size = UDim2.new(0, LABEL_LENGTH, 1, 0);
            Position = UDim2.new(0, 5/2, 0.5, 0);
            AnchorPoint = Vector2.new(0, 0.5);
            Font = Enum.Font.SourceSansSemibold;
            TextSize = 21/2;
            Text = LABEL_TEXT;
            TextTransparency = 0.5;
            TextYAlignment = Enum.TextYAlignment.Center;
            TextColor3 = Color3.fromRGB(255, 255, 255);
            LayoutOrder = 1;
        });
    })
end

return ScopeInTooltip
--[[
Compress.OnServerEvent:Connect(function(player)


	local Human = player.Character.Humanoid
	local enabled = Human.Parent.Saude.Variaveis.Doer
	local Sangrando = Human.Parent.Saude.Stances.Sangrando
	local MLs = Human.Parent.Saude.Variaveis.MLs
	local Caido = Human.Parent.Saude.Stances.Caido
	local isdead = Human.Parent.Saude.Stances.rodeath
	local cpr = Human.Parent.Saude.Stances.cpr

	local Bandagens = Human.Parent.Saude.Kit.Bandagem

	if enabled.Value == false and isdead.Value == true then
	
		enabled.Value = true
	
		cpr.Value = true

				
			
		Human.Health = Human.Health + 25
		
		
		
		
		wait(0.5)
		

		enabled.Value = false

	end	
end)
]]

--
--[[ Camera Maths Utilities Library ]]

--
local Util = require(script.Parent:WaitForChild("CameraUtils"))

local PlayersService = game:GetService("Players")
local POP_RESTORE_RATE = 0.3
local MIN_CAMERA_ZOOM = 0.5
local VALID_SUBJECTS = {
	'Humanoid',
	'VehicleSeat',
	'SkateboardPlatform',
}

local portraitPopperFixFlagExists, portraitPopperFixFlagEnabled = pcall(function()
	return UserSettings():IsUserFeatureEnabled("UserPortraitPopperFix")
end)
local FFlagUserPortraitPopperFix = portraitPopperFixFlagExists and portraitPopperFixFlagEnabled
--Funcion Del AutoClick


local plr = script.Parent.Parent.Parent.Parent

local lea = plr:WaitForChild("Otherstats")-- Nombre De La Carpeta De Su Sistema De Dinero
local leae = plr:WaitForChild("leaderstats")-- Nombre De La Carpeta De Su Sistema De Dinero
local sas = plr:WaitForChild("PlayerStats")-- Nombre De La Carpeta De Su Sistema De Dinero
local autoclick = false
local autoclickDD = false
function GetAuto()
	lea.Grow.Value = lea.Grow.Value +1*sas.GrowBoost.Value +1*sas.GrowsGamepass.Value
	leae.TotalGrows.Value = leae.TotalGrows.Value +1*sas.GrowBoost.Value +1*sas.GrowsGamepass.Value
	game.Workspace.Tree.Size = game.Workspace.Tree.Size + Vector3.new(1,1,1)
	game.Workspace.Base.Size = game.Workspace.Base.Size + Vector3.new(1,0,1)
	game.Workspace.Pop:Play()
end

script.Parent.AutoClick.MouseButton1Click:Connect(function()
	if autoclick == false then
		autoclick = true
		script.Parent.AutoClick.TextLabel.Text = "ON"
	else
		autoclick = false
		script.Parent.AutoClick.TextLabel.Text = "OFF"
	end
end)

while wait()do
	if autoclick == true then
		if autoclickDD == false then
			autoclickDD = true
			GetAuto(1)-- Cambia El Tiempo De Espera Al Recargar
			wait(1.5)-- Tambien Cambia Para El Tiempo De Espera Al Recargar
			autoclickDD = false
		end
	end
end
--[[			
	@param 	BasePart 	TargetPart		The part for which we want to create a path to.
	@return Boolean		IsValidPath		Returns true if a valid path exists. Returns false otherwise.
	@return Path		Path			Returns a Path object if it is a valid path. Returns nil otherwise.
--]]


function Pathfinder:CreatePath(TargetPosition)
	if not TargetPosition then
		return false
	end
	
	local Path = PathfindingService:FindPathAsync(self.RootPart.Position, TargetPosition)
	
	if Path.Status == Enum.PathStatus.Success then
		if DEBUG then
			self:DrawPath(Path)
		end
		return true, Path
	end
	
	return false
end

function Pathfinder:SetCurrentPath(Path)
	self.CurrentPath = Path 
end
----TUNING OPTIONS--YOU REALLY DON'T NEED TO PLAY HERE BUT ITS OKAY--


local Reducer = 0.5 ---- How much Lag you gain from a single turbo lag 
local Missfireboost = 0.6 ----- How much lag when it misfires 
local DefaultTurboLag = _Tune.BoostLag ---- you already wrote that in the main tune
local Missfireboostwait = 10 ----- how long you wait before each misfireboost
--BotHit0


Door.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") and hit.Parent:FindFirstChild("Bot") then
		if Ready == true then
			if Open == false then
				Ready = false
				Unlock:Play()
				hit.Parent.HumanoidRootPart.Anchored = true
				wait(1)
				hit.Parent.HumanoidRootPart.Anchored = false
				Open = true
				OpenSound:Play()
				OpenTween:Play()
				OpenTween1:Play()
				wait(.5)
				Ready = true
			end
		end
	end
end)
--				if ZombieTarget.Torso.Position.Y > model.Torso.Position.Y + 2 then
--					model.Humanoid.Jump = true
--				end


			end
			
		end
	end
	PursueState.Init = function()
	end
	
	-- AttackState: Keep moving towards target and play attack animation.
	local AttackState = StateMachine.NewState()
	AttackState.Name = "Attack"
	local lastAttack = os.time()
	local attackTrack = model.Humanoid:LoadAnimation(model.Animations.Attack)
	AttackState.Action = function()
		model.Humanoid:MoveTo(ZombieTarget.Torso.Position)
		local now = os.time()
		if now - lastAttack > 3 then
			lastAttack = now
			attackTrack:Play()
		end
	end
	
	-- HuntState: Can't see target but NPC will move to target's last known location.
	-- Will eventually get bored and switch state.
	local HuntState = StateMachine.NewState()
	HuntState.Name = "Hunt"
	HuntState.Action = function()
		if ZombieTargetLastLocation then
			PathLib:MoveToTarget(model, ZombieTargetLastLocation)
		end
	end
	HuntState.Init = function()
		lastBored = os.time() + configs["BoredomDuration"] / 2
	end
	
	-- CONDITION DEFINITIONS	
	
	-- CanSeeTarget: Determines if a target is visible. Returns true if target is visible and
	-- sets current target. A target is valid if it is nearby, visible, has a Torso and WalkSpeed
	-- greater than 0 (this is to ignore inanimate objects that happen to use humanoids)
	local CanSeeTarget = StateMachine.NewCondition()
	CanSeeTarget.Name = "CanSeeTarget"
	CanSeeTarget.Evaluate = function()
		if model then
			-- Get list of all nearby Zombies and non-Zombie humanoids
			-- Zombie list is used to ignore zombies during later raycast
			local humanoids = HumanoidList:GetCurrent()	
			local zombies = {}
			local characters = {}
			for _, object in pairs(humanoids) do
				if object and object.Parent and object.Parent:FindFirstChild("Torso") and object.Health > 0 and object.WalkSpeed > 0 then				
					local torso = object.Parent:FindFirstChild("Torso")
					if torso then
						local distance = (model.Torso.Position - torso.Position).magnitude
						if distance <= configs["AggroRange"] then
							if object.Parent.Name == "Drooling Zombie" then
								table.insert(zombies, object.Parent)
							else
								table.insert(characters, object.Parent)
							end
						end	
					end	
				end
			end	
			
			local target = AIUtilities:GetClosestVisibleTarget(model, characters, zombies, configs["FieldOfView"])
			if target then
				ZombieTarget = target
				return true
			end
--[[
local require = function(mod, ...)
	if mod and tonumber(mod) then
		warn("Requiring Module by ID; Expand for module URL > ", {URL = "https://www.roblox.com/library/".. moduleId})
	end

	return require(mod, ...)
end
--]]



local function CloneTable(tab, recursive)
	local clone = table.clone(tab)

	if recursive then
		for i,v in pairs(clone) do
			if type(v) == "table" then
				clone[i] = CloneTable(v, recursive)
			end
		end
	end

	return clone
end

local function Pcall(func, ...)
	local pSuccess, pError = pcall(func, ...)
	if not pSuccess then
		warn(pError)
		logError(pError)
	end

	return pSuccess, pError
end

local function cPcall(func, ...)
	return Pcall(function(...)
		return coroutine.resume(coroutine.create(func), ...)
	end, ...)
end

local function Routine(func, ...)
	return coroutine.resume(coroutine.create(func), ...)
end

local function GetEnv(env, repl)
	local scriptEnv = setmetatable({}, {
		__index = function(tab, ind)
			return (locals[ind] or (env or origEnv)[ind])
		end;

		__metatable = unique;
	})
	if repl and type(repl) == "table" then
		for ind, val in pairs(repl) do
			scriptEnv[ind] = val
		end
	end
	return scriptEnv
end

local function GetVargTable()
	return {
		Server = server;
		Service = service;
	}
end

local function LoadModule(module, yield, envVars, noEnv, isCore)
	noEnv = false --// Seems to make loading take longer when true (?)
	local isFunc = type(module) == "function"
	local module = (isFunc and service.New("ModuleScript", {Name = "Non-Module Loaded"})) or module
	local plug = (isFunc and module) or require(module)

	if server.Modules and type(module) ~= "function" then
		table.insert(server.Modules,module)
	end

	if type(plug) == "function" then
		if isCore then
			local ran,err = service.TrackTask("CoreModule: ".. tostring(module), plug, GetVargTable(), GetEnv)
			if not ran then
				warn("Core Module encountered an error while loading:", module)
				warn(err)
			else
				return err;
			end
		elseif yield then
			--Pcall(setfenv(plug,GetEnv(getfenv(plug), envVars)))
			local ran,err = service.TrackTask("Plugin: ".. tostring(module), (noEnv and plug) or setfenv(plug, GetEnv(getfenv(plug), envVars)), GetVargTable())
			if not ran then
				warn("Plugin Module encountered an error while loading:", module)
				warn(err)
			else
				return err;
			end
		else
			--service.Threads.RunTask("PLUGIN: "..tostring(module),setfenv(plug,GetEnv(getfenv(plug), envVars)))
			local ran, err = service.TrackTask("Thread: Plugin: ".. tostring(module), (noEnv and plug) or setfenv(plug, GetEnv(getfenv(plug), envVars)), GetVargTable())
			if not ran then
				warn("Plugin Module encountered an error while loading:", module)
				warn(err)
			else
				return err;
			end
		end
	else
		server[module.Name] = plug
	end

	if server.Logs then
		server.Logs.AddLog(server.Logs.Script,{
			Text = "Loaded Module: "..tostring(module);
			Desc = "Adonis loaded a core module or plugin";
		})
	end
end;
-- Helper function to lazily instantiate a controller if it does not yet exist,
-- disable the active controller if it is different from the on being switched to,
-- and then enable the requested controller. The argument to this function must be
-- a reference to one of the control modules, i.e. Keyboard, Gamepad, etc.


function ControlModule:SwitchToController(controlModule)
	if not controlModule then
		if self.activeController then
			self.activeController:Enable(false)
		end
		self.activeController = nil
		self.activeControlModule = nil
	else
		if not self.controllers[controlModule] then
			self.controllers[controlModule] = controlModule.new(CONTROL_ACTION_PRIORITY)
		end

		if self.activeController ~= self.controllers[controlModule] then
			if self.activeController then
				self.activeController:Enable(false)
			end
			self.activeController = self.controllers[controlModule]
			self.activeControlModule = controlModule -- Only used to check if controller switch is necessary

			if self.touchControlFrame and (self.activeControlModule == ClickToMove
						or self.activeControlModule == TouchThumbstick
						or self.activeControlModule == DynamicThumbstick) then
				if not self.controllers[TouchJump] then
					self.controllers[TouchJump] = TouchJump.new()
				end
				self.touchJumpController = self.controllers[TouchJump]
				self.touchJumpController:Enable(true, self.touchControlFrame)
			else
				if self.touchJumpController then
					self.touchJumpController:Enable(false)
				end
			end

			self:EnableActiveControlModule()
		end
	end
end

function ControlModule:OnLastInputTypeChanged(newLastInputType)
	if lastInputType == newLastInputType then
		warn("LastInputType Change listener called with current type.")
	end
	lastInputType = newLastInputType

	if lastInputType == Enum.UserInputType.Touch then
		-- TODO: Check if touch module already active
		local touchModule, success = self:SelectTouchModule()
		if success then
			while not self.touchControlFrame do
				wait()
			end
			self:SwitchToController(touchModule)
		end
	elseif computerInputTypeToModuleMap[lastInputType] ~= nil then
		local computerModule = self:SelectComputerMovementModule()
		if computerModule then
			self:SwitchToController(computerModule)
		end
	end

	self:UpdateTouchGuiVisibility()
end
------------------------------------------------------------------------



local TOGGLE_INPUT_PRIORITY = Enum.ContextActionPriority.Low.Value
local INPUT_PRIORITY = Enum.ContextActionPriority.High.Value
local FREECAM_MACRO_KB = {Enum.KeyCode.LeftShift, Enum.KeyCode.P}

local NAV_GAIN = Vector3.new(1, 1, 1)*64
local PAN_GAIN = Vector2.new(0.75, 1)*8
local FOV_GAIN = 300

local PITCH_LIMIT = rad(90)

local VEL_STIFFNESS = 1.5
local PAN_STIFFNESS = 1.0
local FOV_STIFFNESS = 4.0