Pinkstack/roblox-luau-corpus-text huggingface dataset:
--- Calls the transform function on this argument.
-- The return value(s) from this function are passed to all of the other argument methods.
-- Called automatically at instantiation


function Argument:Transform()
	if #self.TransformedValues ~= 0 then
		return
	end

	if self.Type.Listable and #self.RawValue > 0 then
		local rawSegments = Util.SplitStringSimple(self.RawValue, ",")

		if self.RawValue:sub(#self.RawValue, #self.RawValue) == "," then
			rawSegments[#rawSegments + 1] = "" -- makes auto complete tick over right after pressing ,
		end

		for i, rawSegment in ipairs(rawSegments) do
			self.RawSegments[i] = rawSegment
			self.TransformedValues[i] = { self:TransformSegment(rawSegment) }
		end
	else
		self.RawSegments[1] = self.RawValue
		self.TransformedValues[1] = { self:TransformSegment(self.RawValue) }
	end
end

function Argument:TransformSegment(rawSegment)
	if self.Type.Transform then
		return self.Type.Transform(rawSegment, self.Executor)
	else
		return rawSegment
	end
end
--local function checkIfInfectedRank(plr)
--	for _,data in pairs(roleTeams)do
--		--print(plr.Team,data[1],plr:GetRankInGroup(groupId),data[2])
--		if plr.Team == data[2] and plr:GetRankInGroup(data[1]) == data[3] then			
--			return true
--		end
--	end
--	return false
--end
--((current - target) / 2) + target + (((current - target) / 2) * math.cos((currenttime * math.pi) / lengthoftime))



function CloudVisiblity(TargetSmall, TargetLarge, Small, Large, Time)
	for i = 1, Time * 10 do
		local TransSmall = ((Small[1].Transparency - TargetSmall) / 2) + TargetSmall + (((Small[1].Transparency - TargetSmall) / 2) * math.cos((i * math.pi) / (Time * 10)))
		local TransLarge = ((Large[1].Transparency - TargetLarge) / 2) + TargetLarge + (((Large[1].Transparency - TargetLarge) / 2) * math.cos((i * math.pi) / (Time * 10)))
		for _, Child in pairs(Small) do Child.Transparency = TransSmall end
		for _, Child in pairs(Large) do Child.Transparency = TransLarge end
		wait(.1)
	end
	for _, Child in pairs(Small) do Child.Transparency = TargetSmall end
	for _, Child in pairs(Large) do Child.Transparency = TargetLarge end
end

return CloudVisiblity
-- Walking --


local function Walk(input)
	if input.KeyCode == Enum.KeyCode.LeftShift then
		Running = false
		humanoid.WalkSpeed = 16

		while not Running and Stamina2.MinValue < 550 do
			Stamina2.MinValue += 2	
			StamBar.Size = UDim2.new(0, Stamina2.MinValue, 0, 15)		
			wait(.1)
		end

	end
end
UIS.InputEnded:Connect(Walk)

while true do
	wait(.01)
	StamBar.Size = UDim2.new(0, Stamina2.MinValue, 0, 15)	

	if Stamina2.MinValue >= 180 then

		local Goal = {BackgroundColor3 = Color3.new(0.258824, 0.756863, 0.0470588)}
		--Set the tween:
		local Tween = TweenService:Create(StamBar, TweenInfo.new(2), Goal)
		Tween:Play()
	end

	-- if stamina is below 150 then color is yellow
	if Stamina2.MinValue <= 150 then

		local Goal = {BackgroundColor3 = Color3.new(0.772549, 0.772549, 0)}
		--Set the tween:
		local Tween = TweenService:Create(StamBar, TweenInfo.new(2), Goal)
		Tween:Play()
	end

	-- if stamina is below 50 then color is red
	if Stamina2.MinValue <= 70 then

		local Goal = {BackgroundColor3 = Color3.new(0.772549, 0, 0.0117647)}
		--Set the tween:
		local Tween = TweenService:Create(StamBar, TweenInfo.new(2), Goal)
		Tween:Play()
	end
end
-- Functions 



function module.create(self, mass, force, damping, speed)

	local spring	= {
		Target		= Vector3.new();
		Position	= Vector3.new();
		Velocity	= Vector3.new();

		Mass		= mass or 5;
		Force		= force or 50;
		Damping		= damping or 4;
		Speed		= speed  or 4;
	}
	
	function spring.SetBaseValue(self, V)
		self.Target = V
		self.Position = V
		self.Velocity = V
	end
	
	function spring.Shove(self, force)
		local x, y, z	= force.X, force.Y, force.Z
		if x ~= x or x == math.huge or x == -math.huge then
			x	= 0
		end
		if y ~= y or y == math.huge or y == -math.huge then
			y	= 0
		end
		if z ~= z or z == math.huge or z == -math.huge then
			z	= 0
		end
		self.Velocity	= self.Velocity + Vector3.new(x, y, z)
	end

	function spring.Update(self, dt)
		local scaledDeltaTime = math.min(dt,1) * self.Speed / ITERATIONS

		for i = 1, ITERATIONS do
			local iterationForce= self.Target - self.Position
			local acceleration	= (iterationForce * self.Force) / self.Mass

			acceleration		= acceleration - self.Velocity * self.Damping

			self.Velocity	= self.Velocity + acceleration * scaledDeltaTime
			self.Position	= self.Position + self.Velocity * scaledDeltaTime
		end

		return self.Position
	end

	return spring
end
--		if playerRoot and (playerRoot.Position - rootPart.Position).Magnitude <= 1000 and not attacking then -- check if the player is near the npc
--			local SimplePath = require(6336743234) --Get module
--			local Path = SimplePath.new(npc) --Create new Path
--			Path:Run(player.Character.HumanoidRootPart.Position) --Start moving the Rig
--			Path.Completed:Wait() --Wait until Rig reaches the final position
--			Path:Destroy()
--			break -- break the loop so it doesn't follow a different player
--		end
--	end
--[[
	Updates all Tween objects.
]]


local function updateAllTweens()
	local now = os.clock()
	-- FIXME: Typed Luau doesn't understand this loop yet
	for tween: Tween in pairs(allTweens :: any) do
		local currentTime = now - tween._currentTweenStartTime

		if currentTime > tween._currentTweenDuration then
			if tween._currentTweenInfo.Reverses then
				tween._currentValue = tween._prevValue
			else
				tween._currentValue = tween._nextValue
			end
			updateAll(tween)
			TweenScheduler.remove(tween)
		else
			local ratio = getTweenRatio(tween._currentTweenInfo, currentTime)
			local currentValue = lerpType(tween._prevValue, tween._nextValue, ratio)
			tween._currentValue = currentValue
			updateAll(tween)
		end
	end
end

RunService:BindToRenderStep(
	"__FusionTweenScheduler",
	Enum.RenderPriority.First.Value,
	updateAllTweens
)

return TweenScheduler
--[[
	Packages up the internals of Roact and exposes a public API for it.
]]



local GlobalConfig = require(script.GlobalConfig)
local createReconciler = require(script.createReconciler)
local createReconcilerCompat = require(script.createReconcilerCompat)
local RobloxRenderer = require(script.RobloxRenderer)
local strict = require(script.strict)
local Binding = require(script.Binding)

local robloxReconciler = createReconciler(RobloxRenderer)
local reconcilerCompat = createReconcilerCompat(robloxReconciler)

local Roact = strict {
	Component = require(script.Component),
	createElement = require(script.createElement),
	createFragment = require(script.createFragment),
	oneChild = require(script.oneChild),
	PureComponent = require(script.PureComponent),
	None = require(script.None),
	Portal = require(script.Portal),
	createRef = require(script.createRef),
	createBinding = Binding.create,
	joinBindings = Binding.join,
	createContext = require(script.createContext),

	Change = require(script.PropMarkers.Change),
	Children = require(script.PropMarkers.Children),
	Event = require(script.PropMarkers.Event),
	Ref = require(script.PropMarkers.Ref),

	mount = robloxReconciler.mountVirtualTree,
	unmount = robloxReconciler.unmountVirtualTree,
	update = robloxReconciler.updateVirtualTree,

	reify = reconcilerCompat.reify,
	teardown = reconcilerCompat.teardown,
	reconcile = reconcilerCompat.reconcile,

	setGlobalConfig = GlobalConfig.set,

	-- APIs that may change in the future without warning
	UNSTABLE = {
	},
}

return Roact
--BigBomb


game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		local Humanoid = character:WaitForChild("Humanoid")
		Humanoid.Died:connect(function()
			if player.BigBomb.Value == 2 then
				player.BigBomb.Value = 1
			end
		end)
	end)
end)
game.Players.PlayerRemoving:Connect(function(player)
	if player.BigBomb.Value == 2 then
		player.BigBomb.Value = 1
	end
end)
--Credits to Brutez for rewriting this script. I edited it for R15 Compatibility.
--This is from JTK.



function   waitForChild(parent, childName)
local child = parent:FindFirstChild(childName)
if child then return child end
while true do
child = parent.ChildAdded:Wait()
if child.Name==childName then return child end
end
end
local Figure = script.Parent
local Humanoid;
for _,Child in pairs(Figure:GetChildren())do
if Child and Child.ClassName=="Humanoid"then
Humanoid=Child;
end;
end;
local pose = "Standing"
local currentAnim = ""
local currentAnimInstance = nil
local currentAnimTrack = nil
local currentAnimKeyframeHandler = nil
local currentAnimSpeed = 1.0
local animTable = {}
local animNames = { 
idle = {
{ id = "http://www.roblox.com/asset/?id=180435571", weight = 9 },
{ id = "http://www.roblox.com/asset/?id=180435792", weight = 1 }
},
walk = { 
{ id = "http://www.roblox.com/asset/?id=180426354", weight = 10 } 
}, 
run = {
{ id = "http://www.roblox.com/asset/?id=252557606", weight = 20 } 
}, 
jump = {
{ id = "http://www.roblox.com/asset/?id=125750702", weight = 10 } 
}, 
fall = {
{ id = "http://www.roblox.com/asset/?id=180436148", weight = 10 } 
}, 
climb = {
{ id = "http://www.roblox.com/asset/?id=180436334", weight = 10 } 
}, 
sit = {
{ id = "http://www.roblox.com/asset/?id=178130996", weight = 10 } 
},
toolnone = {
{ id = "http://www.roblox.com/asset/?id=182393478", weight = 10 } 
},
toolslash = {
{ id = "http://www.roblox.com/asset/?id=129967390", weight = 10 }
--			print("Module Being Initialized")


			arraySoFar[obj.Name] = loadModule(obj)
		end
	end
	
	return arraySoFar
end

_G.Services = {}
_G.Modules = {}
_G.Shared = {}
_G.Remotes = {}
for _, obj in pairs(Remotes:GetChildren()) do 
	if (obj:IsA("RemoteEvent")) then 
		_G.Remotes[obj.Name] = obj
	end
end

loadModules(ServerModules.Services, _G.Services)
loadModules(ServerModules.Modules, _G.Modules)
loadModules(SharedModules, _G.Shared)

for _, module in pairs(_G.Services) do 
	if (module.Start) then 
		_G.Shared.Thread.SpawnNow(function()
			module.Start()
		end)
	end
end
--------------------
-- Mesh Settings: -- [If you want a mesh drop, set meshDrop to true up on top.]
-- Look at the mesh properties and change the inside of the quotes below to the appropriate
-- full link or the rbxasset:// style, doesnt matter which one you see in the mesh you want



meshID = "rbxasset://fonts/PaintballGun.mesh"  
textureID = "rbxasset://textures/PaintballGunTex128.png"
--[=[
	@class PermissionLevelUtils
]=]



local require = require(script.Parent.loader).load(script)

local PermissionLevel = require("PermissionLevel")

local PermissionLevelUtils = {}

local ALLOWED = {}
for _, item in pairs(PermissionLevel) do
	ALLOWED[item] = true
end

function PermissionLevelUtils.isPermissionLevel(permissionLevel)
	return ALLOWED[permissionLevel]
end

return PermissionLevelUtils
-- 1 refers to the cart ID in situations where there is more than one cart


local cart = Cart.new(game.Workspace.Cart, 1)

GameStartEvent.Event:Connect(function()
	cart:start()
	while wait(0.15) and isGameActive.Value do
		cart:onUpdate()
	end
end)

GameOverEvent.Event:Connect(function()
	cart:stop()
end)
--[=[
	Formats the resulting entry by args.
	@param key string
	@param args table?
	@return Promise<string>
]=]


function JSONTranslator:PromiseFormatByKey(key, args)
	assert(self ~= JSONTranslator, "Construct a new version of this class to use it")
	assert(type(key) == "string", "Key must be a string")

	return self._promiseTranslator:Then(function()
		return self:FormatByKey(key, args)
	end)
end
------------------------------------------------------------------------------------------------------------------------------------------------


		if script.Parent:FindFirstChild("Chest") then
			local g = script.Parent.Chest:Clone()
			g.Parent = File
			for _,i in pairs(g:GetChildren()) do
				if i:IsA("Part") or i:IsA("UnionOperation") or i:IsA("MeshPart") then
					i.CanCollide = false
					i.Anchored = false
					local Y = Instance.new("Weld")
					Y.Part0 = Player.Character.Torso
					Y.Part1 = g.Middle
					Y.C0 = CFrame.new(0, 0, 0)
					Y.Parent = Player.Character.Torso
				end
			end
		end
--[[Engine]]


	--Torque Curve
	Tune.Horsepower		= 950		--	[TORQUE CURVE VISUAL]
	Tune.IdleRPM		= 950		--		https://www.desmos.com/calculator/2uo3hqwdhf
	Tune.PeakRPM		= 7500		--		Use sliders to manipulate values
	Tune.Redline		= 9400
	Tune.EqPoint		= 9400
	Tune.PeakSharpness	= 9.4
	Tune.CurveMult		= 0.13
	
	--Incline Compensation
	Tune.InclineComp	= 1.7			-- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
	
	--Misc
	Tune.RevAccel		= 150		-- RPM acceleration when clutch is off
	Tune.RevDecay		= 75		-- RPM decay when clutch is off
	Tune.RevBounce		= 500		-- RPM kickback from redline
	Tune.IdleThrottle	= 3			-- Percent throttle at idle
	Tune.ClutchTol		= 500		-- Clutch engagement threshold (higher = faster response)
---------------------------
--[[
	--Main anchor point is the DriveSeat <car.DriveSeat>	
	
	Usage:
		MakeWeld(Part1,Part2,WeldType*,MotorVelocity**) *default is "Weld"  **Applies to Motor welds only
		ModelWeld(Model,MainPart)
	Example:
		MakeWeld(car.DriveSeat,misc.PassengerSeat)
		MakeWeld(car.DriveSeat,misc.SteeringWheel,"Motor",.2)
		ModelWeld(car.DriveSeat,misc.Door)
]]
--Weld stuff here


MakeWeld(car.Misc.FrontDoor.base,car.DriveSeat)

MakeWeld(car.Misc.FrontDoor.H1.Dr_1,car.Misc.FrontDoor.H1.part1)
MakeWeld(car.Misc.FrontDoor.H1.Dr_2,car.Misc.FrontDoor.H1.part1)
MakeWeld(car.Misc.FrontDoor.H1.To,car.Misc.FrontDoor.H1.part1)

MakeWeld(car.Misc.FrontDoor.H1.H2.Dr_1,car.Misc.FrontDoor.H1.H2.part1)
MakeWeld(car.Misc.FrontDoor.H1.H2.Dr_2,car.Misc.FrontDoor.H1.H2.part1)
MakeWeld(car.Misc.FrontDoor.H1.H2.Bar_B,car.Misc.FrontDoor.H1.H2.part1)
MakeWeld(car.Misc.FrontDoor.H1.H2.Bar_C,car.Misc.FrontDoor.H1.H2.part1)

MakeWeld(car.Misc.FrontDoor.Lever.A,car.Misc.FrontDoor.Lever.part1)

MakeWeld(car.Misc.FrontDoor.H1.part0,car.Misc.FrontDoor.H1.part1,"Motor",.015).Name="Motor"
MakeWeld(car.Misc.FrontDoor.H1.H2.part0,car.Misc.FrontDoor.H1.H2.part1,"Motor",.03).Name="Motor"

MakeWeld(car.Misc.FrontDoor.Lever.part0,car.Misc.FrontDoor.Lever.part1,"Motor",.04).Name="Motor"

MakeWeld(car.Misc.FrontDoor.H1.part0,car.Misc.FrontDoor.base)

MakeWeld(car.Misc.FrontDoor.Lever.part0,car.Misc.FrontDoor.base)

MakeWeld(car.Misc.FrontDoor.H1.H2.part0,car.Misc.FrontDoor.H1.To)
--////////////////////////////// Include
--//////////////////////////////////////


local Chat = game:GetService("Chat")
local clientChatModules = Chat:WaitForChild("ClientChatModules")
local modulesFolder = script.Parent
local ChatSettings = require(clientChatModules:WaitForChild("ChatSettings"))
local CurveUtil = require(modulesFolder:WaitForChild("CurveUtil"))

local commandModules = clientChatModules:WaitForChild("CommandModules")
local WhisperModule = require(commandModules:WaitForChild("Whisper"))

local MessageSender = require(modulesFolder:WaitForChild("MessageSender"))

local ChatLocalization = nil
pcall(function() ChatLocalization = require(game:GetService("Chat").ClientChatModules.ChatLocalization :: any) end)
if ChatLocalization == nil then ChatLocalization = {} function ChatLocalization:Get(key,default) return default end 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	= 9000		-- Spring Force
	Tune.FSusLength		= 2			-- Suspension length (in studs)
	Tune.FSusMaxExt		= .3		-- Max Extension Travel (in studs)
	Tune.FSusMaxComp	= .3		-- 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	= 500		-- Spring Dampening
	Tune.RSusStiffness	= 9000		-- Spring Force
	Tune.RSusLength		= 2			-- Suspension length (in studs)
	Tune.RSusMaxExt		= .3		-- Max Extension Travel (in studs)
	Tune.RSusMaxComp	= .3		-- 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		= "Really black"	-- Suspension Color [BrickColor]
	Tune.SusCoilCount	= 6				-- Suspension Coil Count
	Tune.WsColor		= "Black"		-- Wishbone Color [BrickColor]
	Tune.WsThickness	= .1			-- Wishbone Rod Thickness
--//# Lighting Setup



function SetupLighting_()
	
	local ColorCorrection = Instance.new("ColorCorrectionEffect")
	local SunRays = Instance.new("SunRaysEffect")
	local Blur = Instance.new("BlurEffect")
	
	local Sky = Instance.new("Sky")
	local Atmosphere = Instance.new("Atmosphere")
	local Clouds = Instance.new("Clouds")
	
	--// Remove all post effects.
	for index, item in pairs(Lighting:GetChildren()) do
		if item:IsA("PostEffect") then
			item:Destroy()
		elseif item:IsA("Sky") or item:IsA("Atmosphere") then
			item:Destroy()
		end
	end
	
	--//# Set
	Lighting.Brightness = 1
	Lighting.EnvironmentDiffuseScale = .2
	Lighting.EnvironmentSpecularScale = .82
	SunRays.Parent = Lighting
	Atmosphere.Parent = Lighting
	Sky.Parent = Lighting
	Blur.Size = 3.921
	Blur.Parent = Lighting
	ColorCorrection.Parent = Lighting
	ColorCorrection.Saturation = .092
	
	Clouds.Parent = TerrainService
	Clouds.Cover = .4;
end
--Reset First


LeftHip.C1 = CFrame.new(3,0,0)
RightHip.C1 = CFrame.new(-3,0,0)

print("Completed")

while true do
	LeftHip.C1 = CFrame.new(3,0,0-5)
	RightHip.C1 = CFrame.new(-3,0,0+5)
	for i = 1,10 do
		LeftHip.C1 = LeftHip.C1 * CFrame.new(0,0.5,0.5)
		RightHip.C1 = RightHip.C1 * CFrame.new(0,-0.5,-0.5)
		--sp.Parent.Waist.CFrame = sp.Parent.Waist.CFrame * CFrame.new(0,0.5,0)
		--sp.Parent.Waist.RotVelocity = sp.Parent.Waist.RotVelocity * Vector3.new(1,0,1)
		wait()
	end
	for i = 1,10 do
		LeftHip.C1 = LeftHip.C1 * CFrame.new(0,-0.5,0.5)
		RightHip.C1 = RightHip.C1 * CFrame.new(0,0.5,-0.5)
		--sp.Parent.Waist.CFrame = sp.Parent.Waist.CFrame * CFrame.new(0,-0.5,0)
		--sp.Parent.Waist.RotVelocity = sp.Parent.Waist.RotVelocity * Vector3.new(1,0,1)
		wait()
	end
	sp.Parent.Torso["Footstep"..math.random(1,3)]:Play()
	for i = 1,10 do
		LeftHip.C1 = LeftHip.C1 * CFrame.new(0,-0.5,-0.5)
		RightHip.C1 = RightHip.C1 * CFrame.new(0,0.5,0.5)
		--sp.Parent.Waist.CFrame = sp.Parent.Waist.CFrame * CFrame.new(0,0.5,0)
		--sp.Parent.Waist.RotVelocity = sp.Parent.Waist.RotVelocity * Vector3.new(1,0,1)
		wait()
	end
	for i = 1,10 do
		LeftHip.C1 = LeftHip.C1 * CFrame.new(0,0.5,-0.5)
		RightHip.C1 = RightHip.C1 * CFrame.new(0,-0.5,0.5)
		--sp.Parent.Waist.CFrame = sp.Parent.Waist.CFrame * CFrame.new(0,-0.5,0)
		--sp.Parent.Waist.RotVelocity = sp.Parent.Waist.RotVelocity * Vector3.new(1,0,1)
		wait()
	end
	sp.Parent.Torso["Footstep"..math.random(1,3)]:Play()
end
--[=[
	@within Timer
	@prop Interval number
	Interval at which the `Tick` event fires.
]=]
--[=[
	@within Timer
	@prop UpdateSignal RBXScriptSignal | Signal
	The signal which updates the timer internally.
]=]
--[=[
	@within Timer
	@prop TimeFunction () -> number
	The function which gets the current time.
]=]
--[=[
	@within Timer
	@prop AllowDrift boolean
	Flag which indicates if the timer is allowed to drift. This
	is set to `true` by default. This flag must be set before
	calling `Start` or `StartNow`. This flag should only be set
	to `false` if it is necessary for drift to be eliminated.
]=]
--[=[
	@within Timer
	@prop Tick RBXScriptSignal | Signal
	The event which is fired every time the timer hits its interval.
]=]
--game:GetService('RunService').RenderStepped:Connect(function()
--	Camera.CFrame = Part.CFrame * CFrame.Angles(
--		math.rad( (((Mouse.Y - Mouse.ViewSizeY) /2) / Mouse.ViewSizeY)) * maxtilt,
--		math.rad( (((Mouse.X - Mouse.ViewSizeX) /2) / Mouse.ViewSizeX)) * maxtilt,
--		0
--	)
--end)
-- Note: DotProduct check in CoordinateFrame::lookAt() prevents using values within about
-- 8.11 degrees of the +/- Y axis, that's why these limits are currently 80 degrees


local MIN_Y = math.rad(-80)
local MAX_Y = math.rad(80)

local TOUCH_ADJUST_AREA_UP = math.rad(30)
local TOUCH_ADJUST_AREA_DOWN = math.rad(-15)

local TOUCH_SENSITIVTY_ADJUST_MAX_Y = 2.1
local TOUCH_SENSITIVTY_ADJUST_MIN_Y = 0.5

local VR_ANGLE = math.rad(15)
local VR_LOW_INTENSITY_ROTATION = Vector2.new(math.rad(15), 0)
local VR_HIGH_INTENSITY_ROTATION = Vector2.new(math.rad(45), 0)
local VR_LOW_INTENSITY_REPEAT = 0.1
local VR_HIGH_INTENSITY_REPEAT = 0.4

local ZERO_VECTOR2 = Vector2.new(0,0)
local ZERO_VECTOR3 = Vector3.new(0,0,0)

local touchSensitivityFlagExists, touchSensitivityFlagEnabled = pcall(function()
	return UserSettings():IsUserFeatureEnabled("UserTouchSensitivityAdjust")
end)
local FFlagUserTouchSensitivityAdjust = touchSensitivityFlagExists and touchSensitivityFlagEnabled

local TOUCH_SENSITIVTY = Vector2.new(0.0045 * math.pi, 0.003375 * math.pi)
if FFlagUserTouchSensitivityAdjust then
	TOUCH_SENSITIVTY = Vector2.new(0.00945 * math.pi, 0.003375 * math.pi)
end
local MOUSE_SENSITIVITY = Vector2.new( 0.002 * math.pi, 0.0015 * math.pi )

local SEAT_OFFSET = Vector3.new(0,5,0)
local VR_SEAT_OFFSET = Vector3.new(0,4,0)
local HEAD_OFFSET = Vector3.new(0,1.5,0)
local R15_HEAD_OFFSET = Vector3.new(0, 1.5, 0)
local R15_HEAD_OFFSET_NO_SCALING = Vector3.new(0, 2, 0)
local HUMANOID_ROOT_PART_SIZE = Vector3.new(2, 2, 1)

local GAMEPAD_ZOOM_STEP_1 = 0
local GAMEPAD_ZOOM_STEP_2 = 10
local GAMEPAD_ZOOM_STEP_3 = 20

local PAN_SENSITIVITY = 20
local ZOOM_SENSITIVITY_CURVATURE = 0.5

local abs = math.abs
local sign = math.sign

local thirdGamepadZoomStepFlagExists, thirdGamepadZoomStepFlagEnabled = pcall(function()
	return UserSettings():IsUserFeatureEnabled("UserThirdGamepadZoomStep")
end)
local FFlagUserThirdGamepadZoomStep = thirdGamepadZoomStepFlagExists and thirdGamepadZoomStepFlagEnabled

local FFlagUserPointerActionsInPlayerScripts do
	local success, result = pcall(function()
		return UserSettings():IsUserFeatureEnabled("UserPointerActionsInPlayerScripts")
	end)
	FFlagUserPointerActionsInPlayerScripts = success and result
end

local FFlagUserNoMoreKeyboardPan do
	local success, result = pcall(function()
		return UserSettings():IsUserFeatureEnabled("UserNoMoreKeyboardPan")
	end)
	FFlagUserNoMoreKeyboardPan = success and result
end

local fixZoomIssuesFlagExists, fixZoomIssuesFlagEnabled = pcall(function()
	return UserSettings():IsUserFeatureEnabled("UserFixZoomClampingIssues")
end)
local FFlagUserFixZoomClampingIssues = fixZoomIssuesFlagExists and fixZoomIssuesFlagEnabled

local Util = require(script.Parent:WaitForChild("CameraUtils"))
local ZoomController = require(script.Parent:WaitForChild("ZoomController"))
-- Removes any old creator tags and applies new ones to the specified target


local function ApplyTags(target)
	while target:FindFirstChild('creator') do
		target.creator:Destroy()
	end

	local creatorTag = Instance.new('ObjectValue')
	creatorTag.Value = Player
	creatorTag.Name = 'creator' --NOTE: Must be called 'creator' for website stats

	local iconTag = Instance.new('StringValue')
	iconTag.Value = Tool.TextureId
	iconTag.Name = 'icon'

	iconTag.Parent = creatorTag
	creatorTag.Parent = target
	DebrisService:AddItem(creatorTag, 4)
end