Roblox/luau_corpus huggingface dataset:
--Loop For Making Rays For The Bullet's Trajectory
for i = 1, 30 do
	local thisOffset = offset + Vector3.new(0, yOffset*(i-1), 0)
	local travelRay = Ray.new(point1,thisOffset)
	local hit, position = workspace:FindPartOnRay(travelRay, parts.Parent)

	local distance 		= (position - point1).magnitude
	round.Size				= Vector3.new(1, distance, 1)
	round.CFrame			= CFrame.new(position, point1)
								* CFrame.new(0, 0, -distance/2)
								* CFrame.Angles(math.rad(90),0,0)
	round.Parent			= workspace
	point1					= point1 + thisOffset
	
	if hit then
		round:remove()
		local e = Instance.new("Explosion")
		e.BlastRadius = 4
		e.BlastPressure = 1
		e.ExplosionType = "NoCraters"
		e.Position = position
		e.Parent = workspace
		
		local players = game.Players:getChildren()
		for i = 1, #players do
			
			if players[i].TeamColor ~= script.Parent.Parent.Tank.Value then --if he's not an ally
				character = players[i].Character
				if character then
					torso = character:findFirstChild'Torso'
					if torso then
						
						torsoPos = torso.Position
						origPos = round.Position
						
						local ray = Ray.new(origPos, torsoPos-origPos)
						local hit, position = game.Workspace:FindPartOnRayWithIgnoreList(ray,ignoreList)
						if hit then
							if hit.Parent == character then
								human = hit.Parent:findFirstChild("Humanoid")
								if human then
									distance = (position-origPos).magnitude
-- Make the HotbarFrame, which holds only the Hotbar Slots
HotbarFrame = NewGui('Frame', 'Hotbar')
HotbarFrame.BackgroundTransparency = 0.7

local grad = script.UICorner:Clone()
grad.Parent = HotbarFrame

HotbarFrame.Parent = MainFrame
--!strict
type Array<T> = { [number]: T }
type PredicateFunction<T> = (value: T, index: number, array: Array<T>) -> boolean

return function<T>(array: Array<T>, predicate: PredicateFunction<T>): T | nil
	for i = 1, #array do
		local element = array[i]
		if predicate(element, i, array) then
			return element
		end
	end
	return nil
end
--[=[
	Get the name of the enum.
	@return string
	@since v2.0.0
]=]
function EnumList:GetName()
	return self[NAME_KEY]
end

export type EnumList = typeof(EnumList.new("", { "" }))

return EnumList
-- find player's head pos

	local vCharacter = Tool.Parent
	local vPlayer = game.Players:playerFromCharacter(vCharacter)

	local head = vCharacter:findFirstChild("Head")
	if head == nil then return end


	local launch = head.Position + 10 * v

	local missile = Pellet:clone()
    
	missile.Position = launch
	missile.Velocity = v * 220--160
	missile.Locked = true


	local force = Instance.new("BodyForce")
	force.force = Vector3.new(0,40,0)
	force.Parent = missile

	if (turbo) then
		missile.Velocity = v * 140
		force.force = Vector3.new(0,45,0)
	end

	missile.SnowballScript.Disabled = false

	local creator_tag = Instance.new("ObjectValue")
	creator_tag.Value = vCharacter
	creator_tag.Name = "creator"
	creator_tag.Parent = missile
	
	missile.Parent = game.Workspace
	
	missile:SetNetworkOwner(vPlayer)

end



function rndDir()
	return Vector3.new(math.random() - .5, math.random() - .5, math.random() - .5).unit
end

Tool.Enabled = true
function onActivated(player,mouseHitp)
	if not Tool.Enabled then
		return
	end

	Tool.Enabled = false
	Tool.Handle.Transparency=1
	local character = Tool.Parent;
	local humanoid = character:FindFirstChild("Humanoid")
	if humanoid == nil then
		return 
	end


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

	fire(lookAt )

	wait(2)
	Tool.Enabled = true
Tool.Handle.Transparency=0

	
end

script.Parent.Clicked.OnServerEvent:connect(onActivated)
--[SETTINGS]--

['OwnerName'] = ""; -- put your EXACT username between the quotations

['BadgeID'] = 0; -- replace 0 with the number ID of your badge

}
-- functions

function stopAllAnimations()
	local oldAnim = currentAnim

	-- return to idle if finishing an emote
	if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
		oldAnim = "idle"
	end

	currentAnim = ""
	if (currentAnimKeyframeHandler ~= nil) then
		currentAnimKeyframeHandler:disconnect()
	end

	if (oldAnimTrack ~= nil) then
		oldAnimTrack:Stop()
		oldAnimTrack:Destroy()
		oldAnimTrack = nil
	end
	if (currentAnimTrack ~= nil) then
		currentAnimTrack:Stop()
		currentAnimTrack:Destroy()
		currentAnimTrack = nil
	end
	return oldAnim
end

local function keyFrameReachedFunc(frameName)
	if (frameName == "End") then
--Valve Properties
local BOVsound = car.DriveSeat.BOV
BOVsound.Volume = .2 --Bov Volume
BOVsound.Pitch = 1 -- Pitch [Don't change this]
BOVsound.SoundId = "rbxassetid://151152187" --Sound

local CPSI = 0
local Values = script.Parent.Parent:FindFirstChild("A-Chassis Interface")
local Throttle = Values.Values.Throttle.Value
local CurrentGear = Values.Values.Gear.Value
local CurrentRPM = Values.Values.RPM.Value
local _Tune = require(car["A-Chassis Tune"])
local MaxRPM = _Tune.Redline
Values.Values.TPSI.Value = PSI
local DEADBOOST = PSI - 0.5
local active = false
local boom = true
-- Watch for foreign additions to game-related locations
wait(10)
plr.PlayerGui.MainGui.ChildAdded:connect(function()
	kick()
end)
plr.PlayerScripts.ChildAdded:connect(function()
	kick()
end)
plr.PlayerScripts.Functions.ChildAdded:connect(function()
	kick()
end)
-- TYPE DEFINITION: Part Cache Instance
export type PartCache = {
	Open: {[number]: BasePart},
	InUse: {[number]: BasePart},
	CurrentCacheParent: Instance,
	Template: BasePart,
	ExpansionSize: number,
	Trails: {[number]: Instance},
}
-- Initialize decorate tool
local DecorateTool = require(CoreTools:WaitForChild 'Decorate')
Core.AssignHotkey('P', Core.Support.Call(Core.EquipTool, DecorateTool));
Core.AddToolButton(Core.Assets.DecorateIcon, 'P', DecorateTool)

return Core
-- Defina a prioridade da animação para inativo
idleAnimationTrack.Priority = Enum.AnimationPriority.Idle
----------------------------------------------------------------------------------
while true do
	WaitTime = ((math.random()*1.9)+0.1)
			--print(WaitTime)
		wait(WaitTime/GeneralSpeed)
		--print(math.random())
	RandomBrightness = ((math.random()*1.5)+2)
			--print(RandomBrightness)
		light.Brightness = RandomBrightness -- brightness
end
-- a: amplitud
-- p: period
local function outInElastic(t, b, c, d, a, p)
	if t < d / 2 then
		return outElastic(t * 2, b, c / 2, d, a, p)
	else
		return inElastic((t * 2) - d, b + c / 2, c / 2, d, a, p)
	end
end

local function inBack(t, b, c, d, s)
	if not s then s = 1.70158 end
	t = t / d
	return c * t * t * ((s + 1) * t - s) + b
end

local function outBack(t, b, c, d, s)
	if not s then s = 1.70158 end
	t = t / d - 1
	return c * (t * t * ((s + 1) * t + s) + 1) + b
end

local function inOutBack(t, b, c, d, s)
	if not s then s = 1.70158 end
	s = s * 1.525
	t = t / d * 2
	if t < 1 then
		return c / 2 * (t * t * ((s + 1) * t - s)) + b
	else
		t = t - 2
		return c / 2 * (t * t * ((s + 1) * t + s) + 2) + b
	end
end

local function outInBack(t, b, c, d, s)
	if t < d / 2 then
		return outBack(t * 2, b, c / 2, d, s)
	else
		return inBack((t * 2) - d, b + c / 2, c / 2, d, s)
	end
end

local function outBounce(t, b, c, d)
	t = t / d
	if t < 1 / 2.75 then
		return c * (7.5625 * t * t) + b
	elseif t < 2 / 2.75 then
		t = t - (1.5 / 2.75)
		return c * (7.5625 * t * t + 0.75) + b
	elseif t < 2.5 / 2.75 then
		t = t - (2.25 / 2.75)
		return c * (7.5625 * t * t + 0.9375) + b
	else
		t = t - (2.625 / 2.75)
		return c * (7.5625 * t * t + 0.984375) + b
	end
end

local function inBounce(t, b, c, d)
	return c - outBounce(d - t, 0, c, d) + b
end

local function inOutBounce(t, b, c, d)
	if t < d / 2 then
		return inBounce(t * 2, 0, c, d) * 0.5 + b
	else
		return outBounce(t * 2 - d, 0, c, d) * 0.5 + c * .5 + b
	end
end

local function outInBounce(t, b, c, d)
	if t < d / 2 then
		return outBounce(t * 2, b, c / 2, d)
	else
		return inBounce((t * 2) - d, b + c / 2, c / 2, d)
	end
end

return {
	linear = linear,
	inQuad = inQuad,
	outQuad = outQuad,
	inOutQuad = inOutQuad,
	outInQuad = outInQuad,
	inCubic  = inCubic ,
	outCubic = outCubic,
	inOutCubic = inOutCubic,
	outInCubic = outInCubic,
	inQuart = inQuart,
	outQuart = outQuart,
	inOutQuart = inOutQuart,
	outInQuart = outInQuart,
	inQuint = inQuint,
	outQuint = outQuint,
	inOutQuint = inOutQuint,
	outInQuint = outInQuint,
	inSine = inSine,
	outSine = outSine,
	inOutSine = inOutSine,
	outInSine = outInSine,
	inExpo = inExpo,
	outExpo = outExpo,
	inOutExpo = inOutExpo,
	outInExpo = outInExpo,
	inCirc = inCirc,
	outCirc = outCirc,
	inOutCirc = inOutCirc,
	outInCirc = outInCirc,
	inElastic = inElastic,
	outElastic = outElastic,
	inOutElastic = inOutElastic,
	outInElastic = outInElastic,
	inBack = inBack,
	outBack = outBack,
	inOutBack = inOutBack,
	outInBack = outInBack,
	inBounce = inBounce,
	outBounce = outBounce,
	inOutBounce = inOutBounce,
	outInBounce = outInBounce,
}
--//Other//--
local UserInputService = game:GetService("UserInputService")
local Equipped = false
local event = script.Parent.Blocking
local event2 = script.Parent.BlockingStop
local blocking = false
local debounce = false

tool.Equipped:Connect(function()
	Equipped = true
	UserInputService.InputBegan:Connect(function(Input,Typing)
		if Typing == false and Input.KeyCode == Enum.KeyCode.E and Equipped == true and blocking == false and debounce == false then
			blockstarttrack:Play()
			hum.WalkSpeed = 6
			debounce = true
			blockholdtrack:Play()
			event:FireServer(hum)
			blocking = true
			wait(4)
			event2:FireServer(hum)
			blockholdtrack:Stop()
			hum.WalkSpeed = 16
			wait(1)
			debounce = false
			blocking = false
		end
		if Typing == false and Input.UserInputType == Enum.UserInputType.MouseButton1 and Equipped == true then
			event2:FireServer(hum)
			blockholdtrack:Stop()
			hum.WalkSpeed = 16
			debounce = false
			blocking = false
		end
	end)
end)

tool.Unequipped:Connect(function()
	Equipped = false
	if blocking == true then
		hum.WalkSpeed = 16
		event2:FireServer(hum)
		blockholdtrack:Stop()
		blocking = false
		debounce = false
	end
end)
-- Ring2 descending
for l = 1,#lifts2 do
	if (lifts2[l].className == "Part") then
	lifts2[l].BodyPosition.position = Vector3.new((lifts2[l].BodyPosition.position.x),(lifts2[l].BodyPosition.position.y-2),(lifts2[l].BodyPosition.position.z))
	end
end
wait(0.1)
for p = 1,#parts2 do
	parts2[p].CanCollide = false
end
wait(0.1)
-- Class

local RadioButtonLabelClass = {}
RadioButtonLabelClass.__index = RadioButtonLabelClass
RadioButtonLabelClass.__type = "RadioButtonLabel"

function RadioButtonLabelClass:__tostring()
	return RadioButtonLabelClass.__type
end
-- (Hat Giver Script - Loaded.)

debounce = true

function onTouched(hit)
	if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true) then
		debounce = false
		h = Instance.new("Hat")
		p = Instance.new("Part")
		h.Name = "GreenTopHat"
		p.Parent = h
		p.Position = hit.Parent:findFirstChild("Head").Position
		p.Name = "Handle" 
		p.formFactor = 0
		p.Size = Vector3.new(0,-0.25,0) 
		p.BottomSurface = 0 
		p.TopSurface = 0 
		p.Locked = true 
		script.Parent.Mesh:clone().Parent = p
		h.Parent = hit.Parent
		h.AttachmentPos = Vector3.new(0,0.85,0)
		wait(5)
		debounce = true
	end
end

script.Parent.Touched:connect(onTouched)
-- goro7

game.ReplicatedStorage.Interactions.Server.GetVIPServerOwnerID.OnServerInvoke = function(plr)
	
	-- Return owner
	return game.VIPServerOwnerId
	
end
-- ================================================================================
-- LOCAL FUNCTIONS
-- ================================================================================
local function UpdateDirection(arrow, targets)
	if targets == 0 then return end
	
	local checkpoint = targets[1]:FindFirstChild("Checkpoint")
	local closestDistance = (arrow.Position - checkpoint.Position).magnitude
	local closestTarget = checkpoint
	
	-- Find nearest target
	for _, target in ipairs(targets) do
		checkpoint = target:FindFirstChild("Checkpoint")
		local distance = (arrow.Position - checkpoint.Position).magnitude
		if distance < closestDistance then
			closestTarget = checkpoint
		end
	end
	
	-- Point arrow at nearest target
	arrow.CFrame = CFrame.new(arrow.Position, closestTarget.Position)
end -- UpdateDirection()
--[[
	Set up the internals of this script the same way you would a regular game. DO NOT change the name(s) of any of the folders already inside of this script.
	Once you're done setting everything up, publish this model, copy the ID, Make the model PUBLIC (due to roblox removing private modules), 
	and paste the ID into the ArenaID Section under Edit Federation in 2X19.
	
	If you want to import terrain into the game, put a terrainregion into workspace. (Recommended: https://create.roblox.com/marketplace/asset/148042198/Terrain-Save-and-Load)

	to make said terrain spawnable/despawnable, put it in serverstorage, it will automatically be loaded and unloaded when using the spawn/despawn commands.
	
]]
return script
--throttle.Value = TCount

if script.Parent.Storage.Control.Value ~= "Controller" then
script.Parent.Storage.Throttle.Throttle.Value = 1	
end

if script.Parent.Storage.Control.Value ~= "Controller" then
if carSeat.Throttle == 1 then
if autoF - 1 > autoR or clutch.Clutch.Value ~= 1 then
	TCount = 1 
	else
	if TCount >= 1 then
		TCount = 1
	else
		if speed > 50 then
		TCount = TCount + 0.167
		
		elseif speed < 20 then
		TCount = TCount + 0.3334
		
			else
		TCount = TCount + 0.02
		end
	end
	
	end
else
	if TCount <= 0 then
		TCount = 0
	else
		TCount = 0
	end
end
else TCount = throttle.Throttle.Value
end

if currentgear.Value ~= 1 then tlR = 0
	if clutch.Clutch.Value ~= 1 then
		if throttle.Value ~= 0 then
			if engine.Value > redline.Value * (1-clutch.Clutch.Value) then --------------?? WE DONT NEED A 'FOR' IN THE CLUTCH CODE
				engine.Value = engine.Value - 300
				else
				engine.Value = engine.Value + (((600+decay.Value) * script.Parent.Storage.Throttle.Throttle.Value) - decay.Value) 
			end else engine.Value = engine.Value - decay.Value
		end
		rpm.Value = engine.Value
	else
		engine.Value = rpm.Value
	end
else
	tlR = tlR + 0.05
	if tlR > 20 then
		script.Parent.Functions.Engine.Value = false
		first = 0.333
	end
	engine.Value = engine.Value + (((600+decay.Value) * first) - decay.Value)
	if engine.Value > idle.Value*2 then
		first = 0 
	end
		--engine.Value = (idle.Value-decay.Value)
		
end
-- To make this work, simply group it with the model you want!


local modelbackup = script.Parent.Parent:FindFirstChild(modelname):clone()
local trigger = script.Parent

enabled = true

function onTouched(hit)
	

	if enabled == true then

		enabled = false
		trigger.BrickColor = BrickColor.new("Really black")

	if script.Parent.Parent:FindFirstChild(modelname) ~= nil then

		script.Parent.Parent:FindFirstChild(modelname):Destroy()


	end
wait(120)
		local modelclone = modelbackup:clone()
		modelclone.Parent = script.Parent.Parent
		modelclone:MakeJoints()

		wait(WaitTime)
		
		enabled = true
		trigger.BrickColor = BrickColor.new("Bright violet")

	end

end
script.Parent.Touched:connect(onTouched)
--edit the below function to execute code when this response is chosen OR this prompt is shown
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data
return function(player, dialogueFolder)
	local plrData = require(game.ReplicatedStorage.Source.Modules.Util):GetPlayerData(player)
	plrData.Money.Gold.Value = plrData.Money.Gold.Value - 6
	plrData.Character.Injuries.Trauma.Value = false
end
-- humanoidAnimatePlayEmote.lua

local Figure = script.Parent
local Torso = Figure:WaitForChild("Torso")
local RightShoulder = Torso:WaitForChild("Right Shoulder")
local LeftShoulder = Torso:WaitForChild("Left Shoulder")
local RightHip = Torso:WaitForChild("Right Hip")
local LeftHip = Torso:WaitForChild("Left Hip")
local Neck = Torso:WaitForChild("Neck")
local Humanoid = Figure:WaitForChild("Humanoid")
local pose = "Standing"

local EMOTE_TRANSITION_TIME = 0.1

local userAnimateScaleRunSuccess, userAnimateScaleRunValue = pcall(function() return UserSettings():IsUserFeatureEnabled("UserAnimateScaleRun") end)
local userAnimateScaleRun = userAnimateScaleRunSuccess and userAnimateScaleRunValue

local function getRigScale()
	if userAnimateScaleRun then
		return Figure:GetScale()
	else
		return 1
	end
end

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=14004765857", weight = 10 } 
			}, 
	run = 	{
				{ id = "run.xml", weight = 10 } 
			}, 
	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 }
--[[
	An implementation of Promises similar to Promise/A+.
]]
local tutils = require(script.Parent.tutils)

local PROMISE_DEBUG = true
--[=[
	Utility functions for the TemplateProvider
	@class TemplateContainerUtils
]=]

local Workspace = game:GetService("Workspace")
local RunService = game:GetService("RunService")

local TemplateContainerUtils = {}

function TemplateContainerUtils.reparentFromWorkspaceIfNeeded(parent, name)
	assert(typeof(parent) == "Instance", "Bad parent")
	assert(type(name) == "string", "Bad name")

	local workspaceContainer = Workspace:FindFirstChild(name)
	local parentedContainer = parent:FindFirstChild(name)
	if workspaceContainer then
		if parentedContainer then
			error(("Duplicate container in %q and %q"):format(
				workspaceContainer:GetFullName(),
				parentedContainer:GetFullName()))
		end

		-- Reparent
		if RunService:IsRunning() then
			workspaceContainer.Parent = parent
		end

		return workspaceContainer
	end

	if not parentedContainer then
		error(("No template container with name %q in %q")
			:format(parent:GetFullName(), name))
	end

	return parentedContainer
end

return TemplateContainerUtils
--[[Weight and CG]]
Tune.Weight			= 3934		-- Total weight (in pounds)
Tune.WeightBSize	= {			-- Size of weight brick (dimmensions in studs ; larger = more stable)
	--[[Width]]		6		,
	--[[Height]]		3.5		,
	--[[Length]]		14		}
Tune.WeightDist		= 50		-- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
Tune.CGHeight		= .8		-- Center of gravity height (studs relative to median of all wheels)
Tune.WBVisible		= false		-- Makes the weight brick visible
-- Decompiled with the Synapse X Luau decompiler.

return function(p1)
	local v1 = 0;
	for v2 in pairs(p1) do
		v1 = v1 + 1;
	end;
	return v1;
end;
--[[
	Package link auto-generated by Rotriever
]]
local PackageIndex = script.Parent.Parent._Index

local Package = require(PackageIndex["TestEZ-28fc8954-0.4.2"]["TestEZ"])

return Package
--[[
		___      _______                _     
	   / _ |____/ ___/ /  ___ ____ ___ (_)__ 
	  / __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
	 /_/ |_|   \___/_//_/\_,_/___/___/_/___/
 						SecondLogic @ Inspare
]]


local autoscaling	= false					--Estimates top speed

local UNITS	= {								--Click on speed to change units
											--First unit is default	
	{
		units			= "MPH"				,
		scaling			= (10/12) * (60/88)	, -- 1 stud : 10 inches | ft/s to MPH
		maxSpeed		= 140				,
		spInc			= 20				, -- Increment between labelled notches
	},
	
	{
		units			= "KM/H"			,
		scaling			= (10/12) * 1.09728	, -- 1 stud : 10 inches | ft/s to KP/H
		maxSpeed		= 240				,
		spInc			= 20				, -- Increment between labelled notches
	},
	
	{
		units			= "SPS"				,
		scaling			= 1					, -- Roblox standard
		maxSpeed		= 200				,
		spInc			= 40				, -- Increment between labelled notches
	}
}
--local MouseInput = Tool:WaitForChild("MousePos",10)

local Services = {
	Players = (game:FindService("Players") or game:GetService("Players")),
	TweenService = (game:FindService("TweenService") or game:GetService("TweenService")),
	RunService = (game:FindService("RunService") or game:GetService("RunService")),
	Input = (game:FindService("ContextActionService") or game:GetService("ContextActionService"))
}

local Player,Character,Humanoid


function Primary(actionName, inputState, inputObj)
	if inputState == Enum.UserInputState.Begin then 
		Remote:FireServer(Enum.KeyCode.Q)
	end
end

function Equipped()
	Player = Services.Players.LocalPlayer
	Character = Player.Character
	Humanoid = Character:FindFirstChildOfClass("Humanoid")
	if not Humanoid or not Humanoid.Parent or Humanoid.Health <= 0 then return end
	
	Services.Input:BindAction("Primary",Primary,true,Enum.KeyCode.Q,Enum.KeyCode.ButtonX)
	Services.Input:SetTitle("Primary","Black hole")
	Services.Input:SetPosition("Primary",UDim2.new(.5,0,-.5,0))
end

function Unequipped()
	Services.Input:UnbindAction("Primary")	
end

Tool.Equipped:Connect(Equipped)
Tool.Unequipped:Connect(Unequipped)
-- Used to lock the chat bar when the user has chat turned off.
function methods:DoLockChatBar()
	if self.TextLabel then
		if LocalPlayer.UserId > 0 then
			self.TextLabel.Text = "To chat in game, turn on chat in your Privacy Settings."
		else
			self.TextLabel.Text = "Sign up to chat in game."
		end
		self:CalculateSize()
	end
	if self.TextBox then
		self.TextBox.Active = false
		self.TextBox.Focused:connect(function()
			self.TextBox:ReleaseFocus()
		end)
	end
end

function methods:SetUpTextBoxEvents(TextBox, TextLabel, MessageModeTextButton)
	--// Code for getting back into general channel from other target channel when pressing backspace.
	UserInputService.InputBegan:connect(function(inputObj, gpe)
		if (inputObj.KeyCode == Enum.KeyCode.Backspace) then
			if (self:IsFocused() and TextBox.Text == "") then
				self:SetChannelTarget(ChatSettings.GeneralChannelName)
			end
		end
	end)

	TextBox.Changed:connect(function(prop)
		if prop == "AbsoluteSize" then
			self:CalculateSize()
			return
		end

		if prop ~= "Text" then
			return
		end

		self:CalculateSize()

		if (string.len(TextBox.Text) > ChatSettings.MaximumMessageLength) then
			TextBox.Text = string.sub(TextBox.Text, 1, ChatSettings.MaximumMessageLength)
			return
		end

		if not self.InCustomState then
			local customState = self.CommandProcessor:ProcessInProgressChatMessage(TextBox.Text, self.ChatWindow, self)
			if customState then
				self.InCustomState = true
				self.CustomState = customState
			end
		else
			self.CustomState:TextUpdated()
		end
	end)

	local function UpdateOnFocusStatusChanged(isFocused)
		if isFocused or TextBox.Text ~= "" then
			TextLabel.Visible = false
		else
			TextLabel.Visible = true
		end
	end

	MessageModeTextButton.MouseButton1Click:connect(function()
		if MessageModeTextButton.Text ~= "" then
			self:SetChannelTarget(ChatSettings.GeneralChannelName)
		end
	end)

	TextBox.Focused:connect(function()
		if not self.UserHasChatOff then
			self:CalculateSize()
			UpdateOnFocusStatusChanged(true)
		end
	end)

	TextBox.FocusLost:connect(function(enterPressed, inputObject)
		self:CalculateSize()
		if (inputObject and inputObject.KeyCode == Enum.KeyCode.Escape) then
			TextBox.Text = ""
		end
		UpdateOnFocusStatusChanged(false)
	end)
end

function methods:GetTextBox()
	return self.TextBox
end

function methods:GetMessageModeTextButton()
	return self.GuiObjects.MessageModeTextButton
end
--[=[
	Adds commas to a number. Not culture aware.
	@param number string | number
	@return string
]=]
function String.addCommas(number: string | number): string
	if type(number) == "number" then
		number = tostring(number)
	end

	local index = -1

	while index ~= 0 do
		number, index = string.gsub(number, "^(-?%d+)(%d%d%d)", '%1,%2')
	end

	return number
end

return String