Pinkstack/roblox-luau-corpus-text huggingface dataset:
-- return to idle if finishing an emote


if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
oldAnim = "idle"
end

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

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

function setAnimationSpeed(speed)
if speed ~= currentAnimSpeed then
currentAnimSpeed = speed
currentAnimTrack:AdjustSpeed(currentAnimSpeed)
end
end

function keyFrameReachedFunc(frameName)
if (frameName == "End") then

local repeatAnim = currentAnim
-- Private Methods



function init(self)
	local frame = self.Frame
	local maid = self._Maid

	maid:Mark(frame:GetPropertyChangedSignal("Text"):Connect(function()
		local mask = self._MaskType
		local result = mask:Process(frame.Text):sub(1, self._MaxLength)
		frame.Text = result
	end))
	
	maid:Mark(frame.FocusLost:Connect(function()
		local mask = self._MaskType
		if (not mask:Verify(frame.Text)) then
			frame.Text = mask.Default
		end
	end))
end
-----------------------------------------------------------------------------------------
--[[
Thanks for using Zed's Mesh Giver 2.0!

Instructions:
1) Find the mesh in you weapon. Generally it should be inside a brick called "Handle"
2) Copy and Paste that mesh into the scenebrick, remove the mesh currently in the scenebrick first.
3) Open up the settings folder in thsi model and edit the following settings:
	- Regen Time: Time it takes for a person to be able to use the giver again.
	- StartColor: Colour of the bricks that are currently blue.
	- RegenColor: Colour of the current blue bricks will be turned to a different color meaning its currently regenrating.
	- WeaponName: Copy and past the exact name of the weapon into the value of the WeaponName value.	
4) Cut and paste the weapon into ServerStorage
5) Done!	
----------------Don't edit below unless you know what you're doing--------------------------
--]]


SColor = script.Parent.Settings:FindFirstChild("StartColor")
RColor = script.Parent.Settings:FindFirstChild("RegenColor")
RTime = script.Parent.Settings:FindFirstChild("RegenTime")
Weapon = script.Parent.Settings:FindFirstChild("WeaponName")
Center = script.Parent.ColoredParts:FindFirstChild("TouchMe")
deb = false


Center.Touched:connect(function(part)
	if part.Parent:FindFirstChild("Humanoid") then
		if part.Parent.Humanoid.Health > 0 then
			if game.Players:FindFirstChild(part.Parent.Name) then
				if game.ServerStorage:FindFirstChild(Weapon.Value) then
					if deb == false then
						deb = true
						for i,v in pairs (script.Parent.ColoredParts:GetChildren()) do
							if v:IsA("Part") then
								v.BrickColor = RColor.Value
							end
						end
						local wep = game.ServerStorage:FindFirstChild(Weapon.Value)
						wep:Clone().Parent = game.Players:FindFirstChild(part.Parent.Name).Backpack
						wait(RTime.Value)
						deb = false
						for i,v in pairs (script.Parent.ColoredParts:GetChildren()) do
							if v:IsA("Part") then
								v.BrickColor = SColor.Value
							end
						end
					end
				else
					print("Error: "..Weapon.Value.." not found in 'ServerStorage'.")
				end
			end
		end
	end
end)
--wait()


local creator = script.Parent:findFirstChild("creator")
local move = script.Parent:findFirstChild("Move")

local active = true

function tagHumanoid(humanoid, creator)
	if creator ~= nil then
		local new_tag = creator:clone()
		new_tag.Parent = humanoid
	end
end

function onPlayerBlownUp(part, distance, creator)
	if part.Name == "Head" then
		local humanoid = part.Parent.Humanoid
		tagHumanoid(humanoid, creator)
	end
end

function set_Off(hit)
	if active == true then
		active = false
		explosion = Instance.new("Explosion")
		explosion.BlastRadius = 45
		explosion.BlastPressure = 50000

		local creator = script.Parent:findFirstChild("creator")
		if creator ~= nil then
			explosion.Hit:connect(function(part, distance)  onPlayerBlownUp(part, distance, creator) end)
		end

		explosion.Position = script.Parent.Position
		explosion.Parent = game.Workspace
		wait()
		script.Parent:remove()
	end
end
script.Parent.Touched:connect(set_Off)

for i = 1,100 do
	wait()
	local desired = Instance.new("Vector3Value")
	desired.Value = script.Parent.CFrame.lookVector * 2100

	local difference = desired.Value - move.velocity

	if difference.magnitude >= move.velocity.magnitude then
		move.velocity = move.velocity + (difference*(0.01*i))
	end
end
--[=[
	Prop that fires when saving. Promise will resolve once saving is complete.
	@prop Saving Signal<Promise>
	@within DataStore
]=]


	self.Saving = Signal.new() -- :Fire(promise)
	self._maid:GiveTask(self.Saving)

	task.spawn(function()
		while self.Destroy do
			for _=1, CHECK_DIVISION do
				task.wait(AUTO_SAVE_TIME/CHECK_DIVISION)
				if not self.Destroy then
					break
				end
			end

			if not self.Destroy then
				break
			end

			-- Apply additional jitter on auto-save
			task.wait(math.random(1, JITTER))

			if not self.Destroy then
				break
			end

			self:Save()
		end
	end)

	return self
end
--// Handling Settings		


	Firerate = 60 / 780; -- 60 = 1 Minute, 780 = Rounds per that 60 seconds. DO NOT TOUCH THE 60!
	
	FireMode = 1; -- 1 = Semi, 2 = Auto, 3 = Burst, 4 = Bolt Action, 5 = Shot, 6 = Explosive
-- Main loop for the entire game


RaceManager:SetRaceDuration(GameSettings.roundDuration)
while true do
	-- Only enter 'Waiting for Players' loop if there are not enough players to start
	-- a round
	if #PlayerManager.ActivePlayers < GameSettings.minimumPlayers then
		RaceManager:SetRaceStatus(RaceManager.Status.WaitingForPlayers)

		DisplayManager.updateTime(0)
		PlayerManager.MiminumActivePlayers:Wait()
	end

	-- Actual Intermission
	gameTimer:stop()
	RaceManager:SetRaceStatus(RaceManager.Status.WaitingForRaceToStart)
	gameTimer:start(GameSettings.intermissionDuration)
	DisplayManager.trackTimer(gameTimer)
	gameTimer.finished:Wait()
	
	-- Prepare players at start of race and start countdown
	PlayerManager:PreparePlayers()
	RaceManager:SetRaceStatus(RaceManager.Status.Countdown)
		
	gameTimer:stop()
	gameTimer:start(GameSettings.countdownDuration)
	DisplayManager.trackTimer(gameTimer)
	gameTimer.finished:Wait()
	
	-- Start the race
	PlayerManager:StartPlayer()
	RaceManager:SetRaceStatus(RaceManager.Status.RoundInProgress)

	gameTimer:stop()
	gameTimer:start(GameSettings.roundDuration)
	DisplayManager.trackTimer(gameTimer)
	RaceManager:Start(PlayerManager.ActivePlayers)
	
	-- Waits until the roundEnd event has fired before continuing the script
	local resultString, raceFinished
	raceFinished = RaceManager.RaceFinished:Connect(function(winner)
		if winner then
			resultString = "WINNER: "..winner.Name
			LeaderboardManager:incrementStat(winner, "Wins")
		else
			resultString = "NOBODY WON!"
		end
		raceFinished:Disconnect()
	end)
	RaceManager.RaceFinished:wait()
	DisplayManager.updateTime(0)
	
	repeat wait() until resultString
	local timeLeft = gameTimer:getTimeLeft() or 0
	local resultTime = GameSettings.roundDuration - timeLeft
	gameTimer:stop()
	PlayerManager:DisplayRoundResult(resultString, resultTime)
	
	gameTimer:start(GameSettings.transitionEnd)
	DisplayManager.trackTimer(gameTimer)

	-- Starts the end intermission
	RaceManager:SetRaceStatus(RaceManager.Status.RoundOver)
	
	wait(GameSettings.transitionEnd)
	
	-- Resets the game by moving players back into the lobby and clearing used variables 
	PlayerManager:ResetPlayers()	
end
-------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------



local toolAnimName = ""
local toolAnimTrack = nil
local toolAnimInstance = nil
local currentToolAnimKeyframeHandler = nil

function toolKeyFrameReachedFunc(frameName)
	if (frameName == "End") then
		--		print("Keyframe : ".. frameName)	
		playToolAnimation(toolAnimName, 0.0, Humanoid)
	end
end


function playToolAnimation(animName, transitionTime, humanoid, priority)	 

	local roll = math.random(1, animTable[animName].totalWeight) 
	local origRoll = roll
	local idx = 1
	while (roll > animTable[animName][idx].weight) do
		roll = roll - animTable[animName][idx].weight
		idx = idx + 1
	end
	--		print(animName .. " * " .. idx .. " [" .. origRoll .. "]")
	local anim = animTable[animName][idx].anim

	if (toolAnimInstance ~= anim) then

		if (toolAnimTrack ~= nil) then
			toolAnimTrack:Stop()
			toolAnimTrack:Destroy()
			transitionTime = 0
		end

		-- load it to the humanoid; get AnimationTrack
		toolAnimTrack = humanoid:LoadAnimation(anim)
		if priority then
			toolAnimTrack.Priority = priority
		end

		-- play the animation
		toolAnimTrack:Play(transitionTime)
		toolAnimName = animName
		toolAnimInstance = anim

		currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc)
	end
end

function stopToolAnimations()
	local oldAnim = toolAnimName

	if (currentToolAnimKeyframeHandler ~= nil) then
		currentToolAnimKeyframeHandler:disconnect()
	end

	toolAnimName = ""
	toolAnimInstance = nil
	if (toolAnimTrack ~= nil) then
		toolAnimTrack:Stop()
		toolAnimTrack:Destroy()
		toolAnimTrack = nil
	end


	return oldAnim
end
--Right Leg


MakeWeld(car.Misc.Anims.R15.RightLeg.Foot.I,car.DriveSeat,"Motor6D").Name="M"
MakeWeld(car.Misc.Anims.R15.RightLeg.Foot.Y,car.Misc.Anims.R15.RightLeg.Foot.I,"Motor6D").Name="M"
MakeWeld(car.Misc.Anims.R15.RightLeg.Foot.Z,car.Misc.Anims.R15.RightLeg.Foot.Y,"Motor6D").Name="M"
MakeWeld(car.Misc.Anims.R15.RightLeg.Foot.X,car.Misc.Anims.R15.RightLeg.Foot.Z,"Motor6D").Name="M"
ModelWeld(car.Misc.Anims.R15.RightLeg.Foot.Parts,car.Misc.Anims.R15.RightLeg.Foot.X)

MakeWeld(car.Misc.Anims.R15.RightLeg.LowerLeg.X,car.Misc.Anims.R15.RightLeg.Foot.X,"Motor6D").Name="M"
ModelWeld(car.Misc.Anims.R15.RightLeg.LowerLeg.Parts,car.Misc.Anims.R15.RightLeg.LowerLeg.X)

MakeWeld(car.Misc.Anims.R15.RightLeg.UpperLeg.X,car.Misc.Anims.R15.RightLeg.LowerLeg.X,"Motor6D").Name="M"
ModelWeld(car.Misc.Anims.R15.RightLeg.UpperLeg.Parts,car.Misc.Anims.R15.RightLeg.UpperLeg.X)
--wander


function wander()
	local x = math.random(script.Parent.Head.Position.X-50,script.Parent.Head.Position.X+50)
	local z = math.random(script.Parent.Head.Position.Z-50,script.Parent.Head.Position.Z+50)
	GoTo(Vector3.new(x,script.Parent.Head.Position,z))
	wait(wandertime)
end
--[[

Rate = How far left / right it goes; if it's 0, then it will decide randomly between two numbers (Edit in script).
Speed = How many studs it moves per second; if the value is 1, it will move one stud every second; two if value is 2; etc.

--]]



local object = script.Parent
local speed = object.Speed.Value
local rate = object.Rate.Value
local direction = Vector3.new(1, 0, 0)

part = {
	move = function() -- Makes it a method :D
		local s = 0.03
		for d = 0,1,s do
			object.CFrame = object.CFrame + Vector3.new(s * direction.X, 0, 0)
			if d % (speed / 10) == 0 then
				print(d)
				wait()
			end
		end
	end
}

while true do
	nRate = rate
	if nRate == 1 then
		nRate = 1 --math.random(-1, 1)
	end
	direction = direction * 1
	for i = 1,nRate do
		part:move()
	end
	wait()
end
-- 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 = ChatLocalization:Get(
				"GameChat_ChatMessageValidator_SettingsError",
				"To chat in game, turn on chat in your Privacy Settings."
			)
		else
			self.TextLabel.Text = ChatLocalization:Get(
				"GameChat_SwallowGuestChat_Message",
				"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)
	-- Clean up events from a previous setup.
	for name, conn in pairs(self.TextBoxConnections) do
		conn:disconnect()
		self.TextBoxConnections[name] = nil
	end

	--// Code for getting back into general channel from other target channel when pressing backspace.
	self.TextBoxConnections.UserInputBegan = 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)

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

		if prop ~= "Text" then
			return
		end

		self:CalculateSize()

		if FFlagUserChatNewMessageLengthCheck2 then
			if utf8.len(utf8.nfcnormalize(TextBox.Text)) > ChatSettings.MaximumMessageLength then
				TextBox.Text = self.PreviousText
			else
				self.PreviousText = TextBox.Text
			end
		else
			if (string.len(TextBox.Text) > ChatSettings.MaximumMessageLength) then
				TextBox.Text = string.sub(TextBox.Text, 1, ChatSettings.MaximumMessageLength)
				return
			end
		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

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

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

	self.TextBoxConnections.TextBoxFocusLost = 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
-- ProductId 1218012568 for 5000 Cash


developerProductFunctions[Config.DeveloperProductIds["5000 Cash"]] = function(receipt, player)
	-- Logic/code for player buying 5000 Cash (may vary)
	local leaderstats = player:FindFirstChild("leaderstats")
	local cash = leaderstats and leaderstats:FindFirstChild("Cash")
	if cash then
		cash.Value += 5000
		-- Indicate a successful purchase
		return true
	end
end
--


wait(1)
	powerlmp.Value = true

function Alert()
	script.Parent.Assembly.Sound.Click:Play()
script.AttackScript.Disabled = true
script.FireScript.Disabled = true
script.Parent.Parent.On.Value = true
end

function Test()
script.Parent.Assembly.Sound.Click:Play()
script.AttackScript.Disabled = true
script.FireScript.Disabled = true
script.Parent.Parent.On.Value = true
end

function Fire()
script.Parent.Assembly.Sound.Click:Play()
script.AttackScript.Disabled = true
script.FireScript.Disabled = false
script.Parent.Parent.On.Value = true
end
	
function Attack()
script.AttackScript.Disabled = false
script.FireScript.Disabled = true
end

function Cancel()
script.Parent.Assembly.Sound.Click:Play()
script.AttackScript.Disabled = true
script.FireScript.Disabled = true
script.Parent.Values.Mode.Value = 0
script.Parent.Parent.On.Value = false
script.Parent.Values.TimerOn.Value = false
end

function Timer()
script.Timer.Disabled = false
signallmp.Value = true
end

script.Parent.Values.TimerOn.Changed:connect(function()
if script.Parent.Values.TimerOn.Value == true then
if script.Parent.Values.Mode.Value == 1 then
Alert()
Timer()
elseif script.Parent.Values.Mode.Value == 2 then
Attack()
Timer()
elseif script.Parent.Values.Mode.Value == 3 then
Fire()
Timer()		
elseif script.Parent.Values.Mode.Value == 7 then
Test()
elseif script.Parent.Values.Mode.Value == 0 then
script.AttackScript.Disabled = true
Cancel()
end
end
end)

script.Parent.Values.Mode.Changed:connect(function()
if script.Parent.Values.Mode.Value == 0 then
Cancel()
end
end)
--[[character.ChildAdded:Connect(function(child)
	if child:IsA("Tool") then
		equipped	= true
		IdleAnimation:Play()
		if sprinting then
			IdleAnimation:Stop()
			SprintAnimation:Play()
		end
		toolEvent		= child.Activated:Connect(function()
			if child.GunType.Value ~= "heal" then
				shooting 	= true
				if sprinting then
					humanoid.WalkSpeed = 16;
					sprinting = false
					SprintAnimation:Stop()
					IdleAnimation:Play()
				end
			end
		end)
		toolEventDe	 	= child.Deactivated:Connect(function()
			shooting 	= false
		end)
	end
end)
character.ChildRemoved:Connect(function(child)
	if child:IsA("Tool") then
		equipped	= false
		IdleAnimation:Stop()
		SprintAnimation:Stop()
		
		if toolEvent ~= nil then
			toolEvent:Disconnect()
			toolEventDe:Disconnect()
		end
	end
end)]]
--//Controller//--


for _, Floaty in pairs(Floaties:GetChildren()) do
	if Floaty:IsA("BasePart") then
		local OrgPos = Floaty.CFrame
		local FloatPos = OrgPos * CFrame.new(
			Random.new():NextNumber(-0.15, 0.15),
			Random.new():NextNumber(0.15, 0.35),
			Random.new():NextNumber(-0.15, 0.15)
			
		) * CFrame.Angles(
			math.rad(Random.new():NextNumber(-3, 3)),
			math.rad(Random.new():NextNumber(-3, 3)),
			math.rad(Random.new():NextNumber(-3, 3))
			
		)
		
		TweenService:Create(
			Floaty,
			TweenInfo.new(
				Random.new():NextNumber(4, 10),
				Enum.EasingStyle.Cubic,
				Enum.EasingDirection.InOut,
				-1,
				true, 0
			),
			{CFrame = FloatPos}
		):Play()
		
	elseif Floaty:IsA("Model") then
		local PrimaryPart = Floaty.PrimaryPart
		
		local OrgPos = PrimaryPart.CFrame
		local FloatPos = OrgPos * CFrame.new(
			Random.new():NextNumber(-0.5, 0.5),
			Random.new():NextNumber(-5, 5),
			Random.new():NextNumber(-0.5, 0.5)

		) * CFrame.Angles(
			math.rad(Random.new():NextNumber(-360, 360)),
			math.rad(Random.new():NextNumber(-360, 360)),
			math.rad(Random.new():NextNumber(-360, 360))

		)
		
		TweenService:Create(
			Floaty.PrimaryPart,
			TweenInfo.new(
				Random.new():NextNumber(10, 15),
				Enum.EasingStyle.Cubic,
				Enum.EasingDirection.InOut,
				-1,
				true, 0
			),
			{CFrame = FloatPos}
		):Play()
	end
end
--[[
Data Ekleme ornek (remotevente bagla)
for i,v in pairs(_G.GlobalData) do
				if v.UserId == targ.UserId then
					for i,data in pairs(_G.GlobalData) do
						if data.UserId == target.UserId then
							table.insert(data.Arrests, 1, pushTab) --Arresting officer, arrest reason, jail time, date
						end
			
--]]



local storage = require(script:WaitForChild("Storage"))
-- play the animation


toolAnimTrack:Play(transitionTime)
toolAnimName = animName
toolAnimInstance = anim
currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc)
end
end
function stopToolAnimations()
local oldAnim = toolAnimName
if (currentToolAnimKeyframeHandler ~= nil) then
currentToolAnimKeyframeHandler:disconnect()
end
toolAnimName = ""
toolAnimInstance = nil
if (toolAnimTrack ~= nil) then
toolAnimTrack:Stop()
toolAnimTrack:Destroy()
toolAnimTrack = nil
end
return oldAnim
end
--	HitSound:Play()


	ball.Parent = nil
end

function tagHumanoid(humanoid)
	-- todo: make tag expire
	local tag = ball:findFirstChild("creator")
	if tag ~= nil then
		local new_tag = tag:clone()
		new_tag.Parent = humanoid
	end
end


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

connection = ball.Touched:connect(onTouched)

wait(5)
ball.Parent = nil
--------AUDIENCE BACK LEFT--------



game.Workspace.audiencebackleft1.Part1.BrickColor = BrickColor.new(1023)
game.Workspace.audiencebackleft1.Part2.BrickColor = BrickColor.new(1023)
game.Workspace.audiencebackleft1.Part3.BrickColor = BrickColor.new(1023)
game.Workspace.audiencebackleft1.Part4.BrickColor = BrickColor.new(106)
game.Workspace.audiencebackleft1.Part5.BrickColor = BrickColor.new(106)
game.Workspace.audiencebackleft1.Part6.BrickColor = BrickColor.new(106)
game.Workspace.audiencebackleft1.Part7.BrickColor = BrickColor.new(1013)
game.Workspace.audiencebackleft1.Part8.BrickColor = BrickColor.new(1013)
game.Workspace.audiencebackleft1.Part9.BrickColor = BrickColor.new(1013)
--Thanks for this, Zeph. Hope you don't mind that I essentially stole this :P



local IntWait = 1
local MD = script.Parent.WPR.SS.Motor
local MD2 = script.Parent.WPR2.SS.Motor

script.Parent.Parent.DriveSeat.Wipers.Changed:Connect(function()
	if script.Parent.Parent.DriveSeat.Wipers.Value == true then
		repeat 
			MD.DesiredAngle = -1.51
			MD2.DesiredAngle = -1.51
			script.Parent.WPR.wiper2["Wiper Sound"]:Play()
			wait(IntWait)
			MD.DesiredAngle = 0
			MD2.DesiredAngle = 0					
			wait(IntWait/2)
		until script.Parent.Parent.DriveSeat.Wipers.Value == false 
		MD.DesiredAngle = 0
		MD2.DesiredAngle = 0
		script.Parent.WPR.wiper2["Wiper Sound"]:Stop()
	end
end)
--[[ END OF SERVICES ]]



local LocalPlayer = PlayersService.LocalPlayer
while LocalPlayer == nil do
	PlayersService.ChildAdded:wait()
	LocalPlayer = PlayersService.LocalPlayer
end

local PlayerGui = LocalPlayer:WaitForChild("PlayerGui")

local success, UserShouldLocalizeGameChatBubble = pcall(function()
	return UserSettings():IsUserFeatureEnabled("UserShouldLocalizeGameChatBubble")
end)
local UserShouldLocalizeGameChatBubble = success and UserShouldLocalizeGameChatBubble

local UserFixBubbleChatText do
	local success, value = pcall(function()
		return UserSettings():IsUserFeatureEnabled("UserFixBubbleChatText")
	end)
	UserFixBubbleChatText = success and value
end

local UserRoactBubbleChatBeta do
	local success, value = pcall(function()
		return UserSettings():IsUserFeatureEnabled("UserRoactBubbleChatBeta")
	end)
	UserRoactBubbleChatBeta = success and value
end

local UserPreventOldBubbleChatOverlap do
	local success, value = pcall(function()
		return UserSettings():IsUserFeatureEnabled("UserPreventOldBubbleChatOverlap")
	end)
	UserPreventOldBubbleChatOverlap = success and value
end

local function getMessageLength(message)
	return utf8.len(utf8.nfcnormalize(message))
end
--// Handling Settings		


	Firerate = 60 / 200; -- 60 = 1 Minute, 200 = Rounds per that 60 seconds. DO NOT TOUCH THE 60!
	
	FireMode = 1; -- 1 = Semi, 2 = Auto, 3 = Burst, 4 = Bolt Action, 5 = Shot, 6 = Explosive
-- Function which acquires the currently idle handler runner thread, runs the
-- function fn on it, and then releases the thread, returning it to being the
-- currently idle one.
-- If there was a currently idle runner thread already, that's okay, that old
-- one will just get thrown and eventually GCed.


local function acquireRunnerThreadAndCallEventHandler(fn, ...)
	local acquiredRunnerThread = freeRunnerThread
	freeRunnerThread = nil
	fn(...)
	-- The handler finished running, this runner thread is free again.
	freeRunnerThread = acquiredRunnerThread
end