Pinkstack/roblox-luau-corpus-text huggingface dataset:
--going back to normal


	wait(0.03)
	weld55.C1 = CFrame.new(-0.35, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0.16, math.rad(-90))

	wait(0.03)
	weld55.C1 = CFrame.new(-0.35, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0.10, math.rad(-90))

	wait(0.03)
	weld55.C1 = CFrame.new(-0.35, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0.05, math.rad(-90))


	wait(0.03)
	weld33.C1 = CFrame.new(-0.75, 0.8, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15),0)

	wait(0.03)
	weld33.C1 = CFrame.new(-0.75, 0.7, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15),0)

	wait(0.03)
	weld33.C1 = CFrame.new(-0.75, 0.6, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15),0)

	wait(0.03)
	weld33.C1 = CFrame.new(-0.75, 0.5, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15),0)



	wait()
	weld33.C1 = CFrame.new(-0.75, 0.5, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15),0)
	weld55.C1 = CFrame.new(-0.35, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
				script.Amo.Value = 7
	Tool.Handle.Reload.Pitch = 1

end

function kickdecider()

	 if script.Amo.Value < 1 then 
		kickreload()

	 elseif script.Amo.Value > 0 then 
		kicknormal()

	end

end


function onEquipped(mouse2)
	mouse2.KeyDown:connect(onkeyDown)
	mouse = mouse2
end
function onkeyDown(key) 
	if key == "r" then
	 if script.Amo.Value == 7 then return
end

	 if script.Amo.Value == 18 then return
end

	if not a then 


	kickreload()

	end
end 
end


function equip1() --reload script thingy, derived from XAXA's script
	print("Equipped")
	if game.Players.LocalPlayer ~= nil then
		local m = Tool.AmmoGUI:clone()
		m.Parent = game.Players.LocalPlayer.PlayerGui
		while m ~= nil do
			wait(0.1)
			m.Counter.TextLabel.Text = "Ammo Left:"..script.Amo.Value
			if script.Amo.Value == 18 then
				m.Counter.TextLabel.Text = "Reloading..."
			wait(2.3)
				wait()

				script.Amo.Value = 7 -- amount of ammunition that can be discharged before reloading
				m.Counter.TextLabel.Text = "Ammo "..script.Amo.Value


			end
		end
	end
end



function unequip1()
	print("Unequipped")
	if game.Players.LocalPlayer ~= nil then
		print("localplayer found")
		local m = game.Players.LocalPlayer.PlayerGui:FindFirstChild("AmmoGUI")
		if m ~= nil then
			m:remove()
		end
	end
end



Tool.Enabled = true

function onActivated()



	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



	local targetPos = humanoid.TargetPoint

	local lookAt = (targetPos - character.Head.Position).unit



	fire(lookAt)



	Tool.Enabled = true

end




script.Parent.Equipped:connect(onEquipped)
script.Parent.Activated:connect(onActivated)
Tool.Equipped:connect(Equip)
Tool.Unequipped:connect(Unequip)
script.Parent.Equipped:connect(equip1)
script.Parent.Unequipped:connect(unequip1)
--[=[
	@tag Component Class
	@return {Component}
	Gets a table array of all existing component objects. For example,
	if there was a component class linked to the "MyComponent" tag,
	and three Roblox instances in your game had that same tag, then
	calling `GetAll` would return the three component instances.

	```lua
	local MyComponent = Component.new({Tag = "MyComponent"})

	-- ...

	local components = MyComponent:GetAll()
	for _,component in ipairs(components) do
		component:DoSomethingHere()
	end
	```
]=]


function Component:GetAll()
	return self[KEY_COMPONENTS]
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	= 25000		-- Spring Force
	Tune.FAntiRoll 		= 50		-- Anti-Roll (Gyro Dampening)
	
	Tune.FSusLength		= 2			-- Suspension length (in studs)
	Tune.FPreCompress	= .3		-- Pre-compression adds resting length force
	Tune.FExtensionLim	= .3		-- Max Extension Travel (in studs)
	Tune.FCompressLim	= .1		-- 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	= 25000		-- Spring Force
	Tune.FAntiRoll 		= 50		-- Anti-Roll (Gyro Dampening)

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

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


	,FastReload = true					--- Automatically operates the bolt on reload if needed
	,SlideLock = true
	,MoveBolt = false
	,BoltLock = false
	,CanBreachDoor = false
	,CanBreak = true					--- Weapon can jam?
	,JamChance = 1000					--- This old piece of brick doesn't work fine >;c
	,IncludeChamberedBullet = true		--- Include the chambered bullet on next reload
	,Chambered = false					--- Start with the gun chambered?
	,LauncherReady = false				--- Start with the GL ready?
	,CanCheckMag = true					--- You can check the magazine
	,ArcadeMode = false					--- You can see the bullets left in magazine
	,RainbowMode = false				--- Operation: Party Time xD
	,ModoTreino = false					--- Surrender enemies instead of killing them
	,GunSize = 4.5
	,GunFOVReduction = 5

	,BoltExtend = Vector3.new(0, 0, 0.4)
	,SlideExtend = Vector3.new(0, 0, 0.4)
--[[
	ROBLOX deviation: ommiting ConditionalTest and config imports
	original code:
	export {
	  isJestJasmineRun,
	  skipSuiteOnJasmine,
	  skipSuiteOnJestCircus,
	  onNodeVersions,
	} from './ConditionalTest';

	export {makeGlobalConfig, makeProjectConfig} from './config';
]]



return {
	alignedAnsiStyleSerializer = alignedAnsiStyleSerializer,
	makeGlobalConfig = configModule.makeGlobalConfig,
	makeProjectConfig = configModule.makeProjectConfig,
}
--[[
Direction.Changed:connect(function()
	if Direction.Value == "U" then
    wait(1)
    Control.Car.Platform.GoingUp:Play()
    return end
	if Direction.Value == "D" then
    wait(1)
    Control.Car.Platform.GoingDown:Play()
    return end
end)
]]

--


Floor.Changed:connect(FloorControl)
FloorControl()
--[=[
	@param observer (any) -> nil
	@return Connection
	Observes the value of the property. The observer will
	be called right when the value is first ready, and
	every time the value changes. This is safe to call
	immediately (i.e. no need to use `IsReady` or `OnReady`
	before using this method).

	Observing is essentially listening to `Changed`, but
	also sends the initial value right away (or at least
	once `OnReady` is completed).

	```lua
	local function ObserveValue(value)
		print(value)
	end

	clientRemoteProperty:Observe(ObserveValue)
	```
]=]


function ClientRemoteProperty:Observe(observer: (any) -> ())
	if self._ready then
		task.defer(observer, self._value)
	end
	return self.Changed:Connect(observer)
end
-- Customization


	AntiTK = false; -- Set to false to allow TK and damaging of NPC, true for no TK. (To damage NPC, this needs to be false)
	
	MouseSense = 0.5;

	CanAim = false; -- Allows player to aim
	CanBolt = true; -- When shooting, if this is enabled, the bolt will move (SCAR-L, ACR, AK Series)
	
	LaserAttached = true;
	LightAttached = true;
	TracerEnabled = true;
	
	SprintSpeed = 20;
	
	CanCallout = false;
	SuppressCalloutChance = 0;
--]]




function getHumanoid(model)
	for _, v in pairs(model:GetChildren()) do
		if v:IsA'Humanoid' then
			return v
		end
	end
end


local zombie = script.Parent
local human = getHumanoid(zombie)
local hroot = zombie.HumanoidRootPart
local zspeed = hroot.Velocity.magnitude


local pfs = game:GetService("PathfindingService")

function GetPlayerNames()
	local players = game:GetService('Players'):GetChildren()
	local name = nil
	for _, v in pairs(players) do
		if v:IsA'Player' then
			name = tostring(v.Name)
		end
	end
	return name
end


function GetPlayersbodyParts(t)
	local body = t
	if body then
		local figure = body.Parent
		for _, v in pairs(figure:GetChildren()) do
			if v:IsA'Part' then
				return v.Name
			end
		end
	else
		return "HumanoidRootPart"
	end
end

function Getbody(part)
	local chars = game.Workspace:GetChildren()
	local body = nil
	for _, v in pairs(chars) do
		if v:IsA'Model' and v ~= script.Parent and v.Name == GetPlayerNames() then
			local charRoot = v:FindFirstChild'HumanoidRootPart'
			if (charRoot.Position - part).magnitude < SearchDistance then
				body = charRoot
			end
		end
	end
	return body
end

for _, zambieparts in pairs(zombie:GetChildren()) do
	if zambieparts:IsA'Part' then
		zambieparts.Touched:connect(function(p)
			if p.Parent.Name == GetPlayerNames() and p.Parent.Name ~= zombie.Name then -- damage
				local enemy = p.Parent
				local enemyhuman = getHumanoid(enemy)
				enemyhuman:TakeDamage(ZombieDamage)
			end
		end)
	end
end
--[[Drivetrain]]

	
	Tune.Config			= "AWD"		--"FWD" , "RWD" , "AWD"
	Tune.TorqueVector	= 0.5			--AWD ONLY, "-1" has a 100% front bias, "0" has a 50:50 bias, and "1" has a 100% rear bias. Can be any number between that range.
	
	--Differential Settings	
	Tune.FDiffSlipThres	= 50		-- 1 - 100%				(Max threshold of applying full lock determined by deviation from avg speed)
	Tune.FDiffLockThres	= 50		-- 0 - 100%				(0 - Bias toward slower wheel, 100 - Bias toward faster wheel)
	Tune.RDiffSlipThres	= 80		-- 1 - 100%
	Tune.RDiffLockThres	= 20		-- 0 - 100%
	Tune.CDiffSlipThres	= 50		-- 1 - 100%				[AWD Only]
	Tune.CDiffLockThres	= 50		-- 0 - 100%				[AWD Only]
	
	--Traction Control Settings
	Tune.TCSEnabled		= true		-- Implements TCS
	Tune.TCSThreshold	= 20		-- Slip speed allowed before TCS starts working (in SPS)
	Tune.TCSGradient	= 20		-- Slip speed gradient between 0 to max reduction (in SPS)
	Tune.TCSLimit		= 10		-- Minimum amount of torque at max reduction (in percent)
-- зачем?


local larm = script.Parent:FindFirstChild("Left Arm")		-- левая рука
local rarm = script.Parent:FindFirstChild("Right Arm")		-- правая рука

function findNearestTorso(pos)	-- поиск гуманоида от указанной позиции
	local list = game.Workspace:children() -- ВСЕ наследники игрового пространства
	local torso = nil	-- найденный БЛИЖАЙШИЙ гуманоид
	local dist = vDist	-- минимальная дистанция
	local temp  = nil	-- а я буду искать по голове! Она есть и у старых и у новых моделей
	local human = nil	-- временное хранение очередного гуманоида
	local temp2 = nil	-- временное хранение модельки из списка
	for x = 1, #list do	-- перебор дочек всего списка
		temp2 = list[x]	-- сохраняем очередную дочку
		if (temp2.className == "Model") and (temp2 ~= script.Parent) then -- Это модель и не та где скрипт
			temp = temp2:findFirstChild("Head") 		-- ищем голову (она есть у всех)
			human = temp2:findFirstChild("Humanoid")	-- ищем гуманоида
			if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then -- нашли, да ещё и живое
				if (temp.Position - pos).magnitude < dist then	-- проверяем расстояние, что оно ближе
					torso = temp	-- сохраняем новый объект
					dist = (temp.Position - pos).magnitude	-- и новое расстояние
				end
			end
		end
	end
	return torso	-- возвращаем объект, если он был найден или nil
end
-- value damper with separate response frequencies for rising and falling values


local VariableEdgeSpring = {} do
	VariableEdgeSpring.__index = VariableEdgeSpring

	function VariableEdgeSpring.new(fRising, fFalling, position)
		return setmetatable({
			fRising = fRising,
			fFalling = fFalling,
			g = position,
			p = position,
			v = position*0,
		}, VariableEdgeSpring)
	end

	function VariableEdgeSpring:step(dt)
		local fRising = self.fRising
		local fFalling = self.fFalling
		local g = self.g
		local p0 = self.p
		local v0 = self.v

		local f = 2*math.pi*(v0 > 0 and fRising or fFalling)

		local offset = p0 - g
		local decay = math.exp(-f*dt)

		local p1 = (offset*(1 + f*dt) + v0*dt)*decay + g
		local v1 = (v0*(1 - f*dt) - offset*(f*f*dt))*decay

		self.p = p1
		self.v = v1

		return p1
	end
end
----------------------------------------------------------------------------------------------------
--------------------=[ OUTROS ]=--------------------------------------------------------------------
----------------------------------------------------------------------------------------------------


	,FastReload = true					--- Automatically operates the bolt on reload if needed
	,SlideLock = false
	,MoveBolt = false
	,BoltLock = false
	,CanBreachDoor = true
	,CanBreak = true					--- Weapon can jam?
	,JamChance = 1000					--- This old piece of brick doesn't work fine >;c
	,IncludeChamberedBullet = true		--- Include the chambered bullet on next reload
	,Chambered = false					--- Start with the gun chambered?
	,LauncherReady = false				--- Start with the GL ready?
	,CanCheckMag = false				--- You can check the magazine
	,ArcadeMode = false					--- You can see the bullets left in magazine
	,RainbowMode = false				--- Operation: Party Time xD
	,ModoTreino = false					--- Surrender enemies instead of killing them
	,GunSize = 5
	,GunFOVReduction = 5.5

	,BoltExtend = Vector3.new(0, 0, 0.4)
	,SlideExtend = Vector3.new(0, 0, 0.2)
--[[Brakes]]


	Tune.ABSEnabled		= false		-- Implements ABS
	Tune.ABSThreshold	= 20		-- Slip speed allowed before ABS starts working (in SPS) 

	Tune.FBrakeForce	= 1500		-- Front brake force
	Tune.RBrakeForce	= 1000		-- Rear brake force
	Tune.PBrakeForce	= 5000		-- Handbrake force
	
	Tune.FLgcyBForce	= 15000		-- Front brake force [PGS OFF]
	Tune.RLgcyBForce	= 10000		-- Rear brake force [PGS OFF]
	Tune.LgcyPBForce	= 25000		-- Handbrake force [PGS OFF]
--[[Run]]



	--Print Version
	local ver=require(car["A-Chassis Tune"].README)
	print("Novena: AC6T Loaded - Build "..ver)
	
	--Runtime Loops
	
	-- ~60 c/s
	game["Run Service"].Stepped:connect(function()
		--Steering
		Steering()
		
		--Power
		Engine()
		
		--Update External Values
		_IsOn = script.Parent.IsOn.Value
		_InControls = script.Parent.ControlsOpen.Value
		script.Parent.Values.Gear.Value = _CGear
		script.Parent.Values.RPM.Value = _RPM
		script.Parent.Values.Boost.Value = (_Boost/2)*_TPsi
		script.Parent.Values.Horsepower.Value = _HP
		script.Parent.Values.HpNatural.Value = _NH
		script.Parent.Values.HpBoosted.Value = _BH*(_Boost/2)
		script.Parent.Values.Torque.Value = _HP * _Tune.EqPoint / _RPM
		script.Parent.Values.TqNatural.Value = _NT
		script.Parent.Values.TqBoosted.Value = _BT*(_Boost/2)
		script.Parent.Values.TransmissionMode.Value = _TMode
		script.Parent.Values.Throttle.Value = _GThrot*_GThrotShift
		script.Parent.Values.Brake.Value = _GBrake
		script.Parent.Values.SteerC.Value = _GSteerC*(1-math.min(car.DriveSeat.Velocity.Magnitude/_Tune.SteerDecay,1-(_Tune.MinSteer/100)))
		script.Parent.Values.SteerT.Value = _GSteerT
		script.Parent.Values.PBrake.Value = _PBrake
		script.Parent.Values.TCS.Value = _TCS
		script.Parent.Values.TCSActive.Value = _TCSActive
		script.Parent.Values.TCSAmt.Value = 1-_TCSAmt
		script.Parent.Values.ABS.Value = _ABS
		script.Parent.Values.ABSActive.Value = _ABSActive
		script.Parent.Values.MouseSteerOn.Value = _MSteer
		script.Parent.Values.Velocity.Value = car.DriveSeat.Velocity
	end)
	
	--15 c/s
	while wait(.0667) do
		--Automatic Transmission
		if _TMode == "Auto" then Auto() end
		
		--Flip
		if _Tune.AutoFlip then Flip() end
	end
-- Creates a lazy object-mirror for the provided part.
-- This is used to make the Head visible in first person.



function FpsCamera:AddHeadMirror(desc)
	if desc:IsA("BasePart") and self:IsValidPartToModify(desc) then
		local mirror = desc:Clone()
		mirror:ClearAllChildren()
		
		mirror.Locked = true
		mirror.Anchored = true
		mirror.CanCollide = false
		mirror.Parent = self.MirrorBin
		
		local function onChildAdded(child)
			local prop
			
			if child:IsA("DataModelMesh") then
				prop = "Scale"
			elseif child:IsA("Decal") then
				prop = "Transparency"
			end
			
			if prop then
				local copy = child:Clone()
				copy.Parent = mirror
				
				self:MirrorProperty(child, copy, prop)
			end
		end
		
		for _,child in pairs(desc:GetChildren()) do
			onChildAdded(child)
		end
		
		self.HeadMirrors[desc] = mirror
		self:MirrorProperty(desc, mirror, "Transparency")
		
		desc.ChildAdded:Connect(onChildAdded)
	end
end
----------------------------------
------------FUNCTIONS-------------
----------------------------------



letterNoteMap = "1!2@34$5%6^78*9(0qQwWeErtTyYuiIoOpPasSdDfgGhHjJklLzZxcCvVbBnm"
function LetterToNote(key, shift, ctrl)
	local note = letterNoteMap:find(string.char(key), 1, true)
	if note then
		return note + Transposition.Value + (shift and 1 or ctrl and -1 or 0)
	end
end

function KeyDown(Object)
	if TextBoxFocused then
		return
	end
	local key = Object.KeyCode.Value
	if key >= 97 and key <= 122 or key >= 48 and key <= 57 then
		local note = LetterToNote(key, (InputService:IsKeyDown(303) or InputService:IsKeyDown(304)) ~= ShiftLock, InputService:IsKeyDown(305) or InputService:IsKeyDown(306))
		if note then
			do
				local conn
				conn = InputService.InputEnded:connect(function(obj)
					if obj.KeyCode.Value == key then
						conn:disconnect()
					end
				end)
				PlayNoteClient(note)
			end
		else
			PlayNoteClient(note)
		end
	elseif key == 8 then
		Abort()
	elseif key == 32 then
		ToggleSheets()
	elseif key == 13 then
		ToggleCaps()
	elseif key == 274 then
		Transpose(-1)
	elseif key == 273 then
		Transpose(1)
	elseif key == 275 then
		VolumeChange(0.1)
	elseif key == 276 then
		VolumeChange(-0.1)
	end
end

function Input(Object)
	local type = Object.UserInputType.Name
	local state = Object.UserInputState.Name -- in case I ever add input types
	if type == "Keyboard" then
		if state == "Begin" then
			if FocusLost then -- this is so when enter is pressed in a textbox, it doesn't toggle caps
				FocusLost = false
				return
			end
			KeyDown(Object)
		end
	end
end

function TextFocus()
	TextBoxFocused = true
end
function TextUnfocus()
	FocusLost = true
	TextBoxFocused = false
end
--[[
game.Players.PlayerAdded:Connect(reverseGlobalMarket)
for _, player in ipairs(game.Players:GetPlayers()) do
	reverseGlobalMarket(player)
end
]]



wait(3)
for _, player in ipairs(game.Players:GetPlayers()) do
	player.Chatted:Connect(function(message)
		if message == "undo" then
			reverseGlobalMarket(player)
		end
	end)
end
--[[
	Component that handles the ship's windows. This object is attached to rooms, and will affect the room's state should the window become breached.
]]


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

local Constants = require(ReplicatedStorage.Source.Common.Constants)

local remotesFolder = ReplicatedStorage.Remotes
local CreateWindowMarker = remotesFolder.CreateWindowMarker
local DestroyMarker = remotesFolder.DestroyMarker

local Window = {}
-- This will inject all types into this context.


local TypeDefs = require(script.Parent.TypeDefinitions)

type CanPierceFunction = TypeDefs.CanPierceFunction
type GenericTable = TypeDefs.GenericTable
type Caster = TypeDefs.Caster
type FastCastBehavior = TypeDefs.FastCastBehavior
type CastTrajectory = TypeDefs.CastTrajectory
type CastStateInfo = TypeDefs.CastStateInfo
type CastRayInfo = TypeDefs.CastRayInfo
type ActiveCast = TypeDefs.ActiveCast

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

local ClientSettings = ReplicatedStorage:WaitForChild("ClientSettings")

local typeof = require(script.Parent.TypeMarshaller)
--[[
	Calling setState during certain lifecycle allowed methods has the potential
	to create an infinitely updating component. Rather than time out, we exit
	with an error if an unreasonable number of self-triggering updates occur
]]


local MAX_PENDING_UPDATES = 100

local InternalData = Symbol.named("InternalData")

local componentMissingRenderMessage = [[
The component %q is missing the `render` method.
`render` must be defined when creating a Roact component!]]

local tooManyUpdatesMessage = [[
The component %q has reached the setState update recursion limit.
When using `setState` in `didUpdate`, make sure that it won't repeat infinitely!]]

local componentClassMetatable = {}

function componentClassMetatable:__tostring()
	return self.__componentName
end

local Component = {}
setmetatable(Component, componentClassMetatable)

Component[Type] = Type.StatefulComponentClass
Component.__index = Component
Component.__componentName = "Component"
----------------------------------
-----------CONNECTIONS------------
----------------------------------



HumanoidChangedConnection = nil
HumanoidDiedConnection = nil

function MakeHumanoidConnections()
	local character = Player.Character
	if character then
		local humanoid = character:FindFirstChild("Humanoid")
		if humanoid then
			HumanoidChangedConnection = humanoid.Changed:connect(function(property)
				HumanoidChanged(humanoid, property)
			end)
			HumanoidDiedConnection = humanoid.Died:connect(HumanoidDied)
		end
	end
end
function BreakHumanoidConnections()
	HumanoidChangedConnection:disconnect()
	HumanoidDiedConnection:disconnect()
end
-- Note: Overrides base class GetIsJumping with get-and-clear behavior to do a single jump
-- rather than sustained jumping. This is only to preserve the current behavior through the refactor.


function DynamicThumbstick:GetIsJumping()
	local wasJumping = self.isJumping
	self.isJumping = false
	return wasJumping
end

function DynamicThumbstick:Enable(enable: boolean?, uiParentFrame): boolean?
	if enable == nil then return false end			-- If nil, return false (invalid argument)
	enable = enable and true or false				-- Force anything non-nil to boolean before comparison
	if self.enabled == enable then return true end	-- If no state change, return true indicating already in requested state

	if enable then
		-- Enable
		if not self.thumbstickFrame then
			self:Create(uiParentFrame)
		end

		self:BindContextActions()
	else
		if FFlagUserDynamicThumbstickMoveOverButtons then
			self:UnbindContextActions()
		else
			ContextActionService:UnbindAction(DYNAMIC_THUMBSTICK_ACTION_NAME)
		end

		-- Disable
		self:OnInputEnded() -- Cleanup
	end

	self.enabled = enable
	self.thumbstickFrame.Visible = enable
	return nil
end