Roblox/luau_corpus huggingface dataset:
--local debris = game:GetService("Debris")

local bot = script.Parent -- bot stuff
local bhum = bot:WaitForChild('Humanoid')
local bhrp = bot:WaitForChild('HumanoidRootPart')

local findPath = PFS:CreatePath({WaypointSpacing = math.huge})
local actPath = PFS:CreatePath({WaypointSpacing = math.huge})

local followedChar -- the one we are already following

local char -- the one which we follow

local function nearestChar()
	while wait() do
		local nearChar, nearDist = nil, nil
		local distance
		local firstPos

		for i,v in pairs(workspace:GetChildren()) do
			if v:FindFirstChild('Humanoid') and v ~= bot and not (v:FindFirstChild('Nextbot') or v:FindFirstChild('NPC')) and v.Humanoid.Health > 0 and v:FindFirstChild('HumanoidRootPart') then
				findPath:ComputeAsync(bhrp.Position, v.HumanoidRootPart.Position)
				if findPath.Status == Enum.PathStatus.Success then
					distance = 0
					for i,waypoint in ipairs(findPath:GetWaypoints()) do
						if i ~= 1 then
							distance = distance + (waypoint.Position - firstPos).Magnitude
						end
						firstPos = waypoint.Position
					end
					if nearDist == nil then
						nearDist = distance
						nearChar = v
					else
						if distance < nearDist then
							nearDist = distance
							nearChar = v
						end
					end
				end
			end
		end
		char = nearChar
	end
end

spawn(nearestChar)

local count = 0

RunS.Heartbeat:Connect(function()
	if count >= 3 then -- You may change this number to your liking, but if you set it too low nextbot will lag
		count = 0
		if char ~= nil and char:FindFirstChild('HumanoidRootPart') then
			actPath:ComputeAsync(bhrp.Position, char.HumanoidRootPart.Position)
			for i,v in ipairs(actPath:GetWaypoints()) do
				if i ~= 1 then
					bhum:MoveTo(v.Position)
					bhum.MoveToFinished:Wait()
				end
			end
		end
	else
		count = count + 1
	end
end)
--[[
	Allows forwarding of refs to underlying host components. Accepts a render
	callback which accepts props and a ref, and returns an element.
]]
local function forwardRef(render)
	if config.typeChecks then
		assert(typeof(render) == "function", "Expected arg #1 to be a function")
	end

	return function(props)
		local ref = props[Ref]
		local propsWithoutRef = assign({}, props, excludeRef)

		return render(propsWithoutRef, ref)
	end
end

return forwardRef
--[[[Default Controls]]
	--Peripheral Deadzones
	Tune.Peripherals = {
		MSteerWidth				= 67		,	-- Mouse steering control width	(0 - 100% of screen width)
		MSteerDZone				= 10		,	-- Mouse steering deadzone (0 - 100%)
		
		ControlLDZone			= 5			,	-- Controller steering L-deadzone (0 - 100%)
		ControlRDZone			= 5			,	-- Controller steering R-deadzone (0 - 100%)
	}
	
	--Control Mapping
	Tune.Controls = {
		
	--Keyboard Controls
		--Mode Toggles
		--ToggleTCS				= Enum.KeyCode.T					,
		ToggleABS				= Enum.KeyCode.Y					,
		ToggleTransMode			= Enum.KeyCode.M					,
		--ToggleMouseDrive		= Enum.KeyCode.R					,
		
		--Primary Controls
		Throttle				= Enum.KeyCode.Up					,
		Brake					= Enum.KeyCode.Down					,
		SteerLeft				= Enum.KeyCode.Left					,
		SteerRight				= Enum.KeyCode.Right				,
		
		--Secondary Controls
		Throttle2				= Enum.KeyCode.W					,
		Brake2					= Enum.KeyCode.S					,
		SteerLeft2				= Enum.KeyCode.A					,
		SteerRight2				= Enum.KeyCode.D					,
		
		--Manual Transmission
		ShiftUp					= Enum.KeyCode.E					,
		ShiftDown				= Enum.KeyCode.Q					,
		Clutch					= Enum.KeyCode.LeftShift			,
		
		--Handbrake
		PBrake					= Enum.KeyCode.P					,
		
	--Mouse Controls
		MouseThrottle			= Enum.UserInputType.MouseButton1	,
		MouseBrake				= Enum.UserInputType.MouseButton2	,
		MouseClutch				= Enum.KeyCode.W					,
		MouseShiftUp			= Enum.KeyCode.E					,
		MouseShiftDown			= Enum.KeyCode.Q					,
		MousePBrake				= Enum.KeyCode.LeftShift			,
		
	--Controller Mapping
		ContlrThrottle			= Enum.KeyCode.ButtonR2				,
		ContlrBrake				= Enum.KeyCode.ButtonL2				,
		ContlrSteer				= Enum.KeyCode.Thumbstick1			,
		ContlrShiftUp			= Enum.KeyCode.ButtonY				,
		ContlrShiftDown			= Enum.KeyCode.ButtonX				,
		ContlrClutch			= Enum.KeyCode.ButtonR1				,
		ContlrPBrake			= Enum.KeyCode.ButtonL1				,
		ContlrToggleTMode		= Enum.KeyCode.DPadUp				,
		ContlrToggleTCS			= Enum.KeyCode.DPadDown				,
		ContlrToggleABS			= Enum.KeyCode.DPadRight			,
	}
-- Blood cache existing check
if not bloodCache then
    bloodCache = Instance.new("Folder")
    bloodCache.Name = "BloodCache"
    bloodCache.Parent = workspace
end
-- 100 == 1  0 == 0  1/0.5

function JamCalculation()
	local L_132_
	if (math.random(1, 100) <= L_21_.JamChance) then	
		L_132_ = true
		L_52_ = true
	else
		L_132_ = false
	end
	return L_132_
end

function TracerCalculation()
	local L_133_
	if (math.random(1, 100) <= L_21_.TracerChance) then	
		L_133_ = true
	else
		L_133_ = false
	end
	return L_133_
end
-- Decompiled with the Synapse X Luau decompiler.

local v1 = {};
Piano = script.Parent;
Box = Piano.Keys.Camera;
v1.PianoSoundRange = 50;
v1.KeyAesthetics = true;
v1.PianoSounds = { "269058581", "269058744", "269058842", "269058899", "269058974", "269059048" };
v1.SoundSource = Piano.Keys.KeyBox;
v1.CameraCFrame = CFrame.new((Box.CFrame * CFrame.new(0, 0, 1)).p, (Box.CFrame * CFrame.new(0, 0, 0)).p);
return v1;
--[=[
	Gets the controller by name. Throws an error if the controller
	is not found.
]=]
function KnitClient.GetController(controllerName: string): Controller
	local controller = controllers[controllerName]
	if controller then
		return controller
	end
	assert(started, "Cannot call GetController until Knit has been started")
	assert(type(controllerName) == "string", "ControllerName must be a string; got " .. type(controllerName))
	error("Could not find controller \"" .. controllerName .. "\". Check to verify a controller with this name exists.", 2)
end
--Rear Suspension
Tune.RSusDamping	= 500		-- Spring Dampening
Tune.RSusStiffness	= 9000		-- 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
---Creator Module Object Keys
local KEY_MESSAGE_TYPE = "MessageType"
local KEY_CREATOR_FUNCTION = "MessageCreatorFunc"
-- Formerly getCurrentCameraMode, this function resolves developer and user camera control settings to
-- decide which camera control module should be instantiated. The old method of converting redundant enum types
function CameraModule:GetCameraControlChoice()
	local player = Players.LocalPlayer

	if player then
		if UserInputService:GetLastInputType() == Enum.UserInputType.Touch or UserInputService.TouchEnabled then
			-- Touch
			if player.DevTouchCameraMode == Enum.DevTouchCameraMovementMode.UserChoice then
				return CameraUtils.ConvertCameraModeEnumToStandard( UserGameSettings.TouchCameraMovementMode )
			else
				return CameraUtils.ConvertCameraModeEnumToStandard( player.DevTouchCameraMode )
			end
		else
			-- Computer
			if player.DevComputerCameraMode == Enum.DevComputerCameraMovementMode.UserChoice then
				local computerMovementMode = CameraUtils.ConvertCameraModeEnumToStandard(UserGameSettings.ComputerCameraMovementMode)
				return CameraUtils.ConvertCameraModeEnumToStandard(computerMovementMode)
			else
				return CameraUtils.ConvertCameraModeEnumToStandard(player.DevComputerCameraMode)
			end
		end
	end
end

function CameraModule:OnCharacterAdded(char, player)
	if self.activeOcclusionModule then
		self.activeOcclusionModule:CharacterAdded(char, player)
	end
end

function CameraModule:OnCharacterRemoving(char, player)
	if self.activeOcclusionModule then
		self.activeOcclusionModule:CharacterRemoving(char, player)
	end
end

function CameraModule:OnPlayerAdded(player)
	player.CharacterAdded:Connect(function(char)
		self:OnCharacterAdded(char, player)
	end)
	player.CharacterRemoving:Connect(function(char)
		self:OnCharacterRemoving(char, player)
	end)
end

function CameraModule:OnMouseLockToggled()
	if self.activeMouseLockController then
		local mouseLocked = self.activeMouseLockController:GetIsMouseLocked()
		local mouseLockOffset = self.activeMouseLockController:GetMouseLockOffset()
		if self.activeCameraController then
			self.activeCameraController:SetIsMouseLocked(mouseLocked)
			self.activeCameraController:SetMouseLockOffset(mouseLockOffset)
		end
	end
end

return CameraModule.new()
--------------------------------------------

game.Players.CharacterAutoLoads = false

function onPlayerDied(player, character)
	wait(respawn_time)
	player:LoadCharacter()
end

function onPlayerSpawned(player, character)
	while not character:FindFirstChild("Humanoid") do wait() end
	character.Humanoid.Died:connect(function () onPlayerDied(player, character) end)
end

function onPlayerChatted(player, message, recipient)
	if message == force_respawn and allow_force_respawn then
		player:LoadCharacter()
	end
end

function onPlayerEntered(player)

	player.CharacterAdded:connect(function (char) onPlayerSpawned(player, char) end)
	player.Chatted:connect(function (msg, rec) onPlayerChatted(player, msg, rec) end)

	player:LoadCharacter()
end

game.Players.PlayerAdded:connect(onPlayerEntered)
--Made by Luckymaxer

Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
RunAnim = Tool:WaitForChild("RunAnim")
Returned = Tool:WaitForChild("Returned")

Debris = game:GetService("Debris")
Players = game:GetService("Players")

Anims = {"RightSlash", "LeftSlash", "OverHeadSwing", "LeftSwingFast", "RightSwingFast"}

BaseDamage = 100
SlashDamage = 100
SwingDamage = 100
Damage = BaseDamage

SlashSound = Instance.new("Sound")
SlashSound.SoundId = "rbxasset://sounds\\swordslash.wav"
SlashSound.Parent = Handle
SlashSound.Volume = 0.7

UnsheathSound = Instance.new("Sound")
UnsheathSound.SoundId = "rbxasset://sounds\\unsheath.wav"
UnsheathSound.Parent = Handle
UnsheathSound.Volume = 0.5

function Blow(Hit)
	if Hit and Hit.Parent then
		local humanoid = Hit.Parent:FindFirstChild("Humanoid")
		if Character and Player and Humanoid and humanoid and humanoid ~= Humanoid and humanoid.Health > 0 and Humanoid.Health > 0 then
			local right_arm = Character:FindFirstChild("Right Arm")
			if right_arm then
				local joint= right_arm:FindFirstChild("RightGrip")
				if joint and (joint.Part0 == Handle or joint.Part1 == Handle) then
					TagHumanoid(humanoid, Player)
					humanoid:TakeDamage(Damage)
				end
			end
		end
	end
end

function TagHumanoid(humanoid, player)
	for i, v in pairs(humanoid:GetChildren()) do
		if v.Name == "creator" then
			v:Destroy()
		end
	end
	local creator_tag = Instance.new("ObjectValue")
	creator_tag.Value = player
	creator_tag.Name = "creator"
	Debris:AddItem(creator_tag, 1)
	creator_tag.Parent = humanoid
end

function OnActivated()
	if Tool.Enabled and Returned.Value then
		Character = Tool.Parent
		Player = Players:GetPlayerFromCharacter(Character)
		Humanoid = Character:FindFirstChild("Humanoid")
		Tool.Enabled = false
		local TempAnims = {}
		for i, v in pairs(Anims) do
			if v ~= LastAnim then
				table.insert(TempAnims, v)
			end
		end
		NewAnim = TempAnims[math.random(1, #TempAnims)]
		LastAnim = NewAnim
		RunAnim.Value = NewAnim
		if Humanoid and NewAnim then
			SlashSound:Play()
			if NewAnim == "OverHeadSwing" then
				Damage = SwingDamage
			else
				Damage = SlashDamage
			end
			wait(0.75)
			Damage = BaseDamage
		end
		Tool.Enabled = true
	end
end

function OnEquipped(Mouse)
	UnsheathSound:Play()
end

Tool.Activated:connect(OnActivated)
Tool.Equipped:connect(OnEquipped)

Connection = Handle.Touched:connect(Blow)
---------------------------
--Seat Offset (Make copies of this block for passenger seats)

car.DriveSeat.ChildAdded:connect(function(child)
	if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
		child.C0=CFrame.new(0,-.5,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0)
	end
end)
car.Body.ChildAdded:connect(function(child)
	if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
		child.C0=CFrame.new(0,-.5,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0)
	end
end)
---------------------------------------------------------------------------------

game.Players.PlayerAdded:Connect(function(plr)
	local DefaultNum = 00000000  -- <-- DO NOT change this to your ID or the script will break!
	if BadgeID == DefaultNum then 
		error("Forgot to add badge ID (line 26)")
	elseif DefaultNum == BadgeID then
		error("Do not change \"DefaultNum\" to your ID (Line 33)")
	elseif BadgeID == nil then
		error("Badge ID doesn't exist or is nil (line 26)")
	end
	print("Giving BadgeID: " .. BadgeID .. " to: " .. plr.Name)
	local b = game:GetService("BadgeService")
	b:AwardBadge(plr.userId, BadgeID)
end)
--Xfabri_YT

local BHTextValue = game.Workspace.HoursValues.BHTextValue

BHTextValue.Changed:Connect(function()
	if BHTextValue.Value == 2 then
		wait()
		script.Parent.BHText.Visible = true
		wait(2)
		script.Parent.BHText.Visible = false
		BHTextValue.Value = 0
	end
end)
--Var
local WaitingInputs = {}

local UIS = {}

function UIS.WaitForInput(inputType)
    local Event = Instance.new("BindableEvent")
    local uisCon
    uisCon = UserInputService.InputBegan:Connect(function(input, gp)
        if (input.UserInputType == inputType) then 
            uisCon:Disconnect()
            Event:Fire()
        end
    end)

    Event.Event:Wait()
end

return UIS
--[[ReadMe*
	Please improve upon this script as needed, I'm a noob scripter and I only script 
	through ways I know that work. This loop works, so I'm happy with it. But please, 
	edit as you may.
	
	This model uses MeshParts to animate the flag. The previous frame turns transparent
	while the next frame becomes visible.
	
	If you would like to use your own custom flag, for your ROBLOX group or country, 
	select all the children in the "Flag" model and paste in a ROBLOX decal asset in 
	the "TextureID" slot. If you receive an error, try subtracting 1 from the decal id.
		
		http://www.roblox.com/asset/?id={decal id}
		rbxassetid://{decal id}
	
	Any ROBLOX decal in the Developers Library will work, or you may upload your own 
	flag decal to insert in. Rectangular decals are recommended for this flag. 
		*If you use a decal with a transparent background in the MeshPart's TextureID, 
		the transparent background will default to black. Instead, insert the actual
		decal into every MeshPart in "Flag." This will allow you to change the BrickColor
		of the flag with the decal on top.
	
	The flags have been UV mapped to flip the flag design on the other side. 
		e.g. You won't see the blue box of the United States flag on the other side
			 of the flag on its end, but close to the pole for both sides.
				
	Thank you and have a wonderful day.
	(MeshParts rendered using Blender)
--]]

sp=script.Parent
flag=sp.Flag

reset=function()
	for _,meshpart in pairs (flag:GetChildren()) do
		if meshpart:IsA("MeshPart") then
			meshpart.Transparency=1
		end
	end
end

waittime=.01 --Time between each "Frame"

while true do
	wait(waittime)
	reset()
	flag["2"].Transparency=0
	wait(waittime)
	reset()
	flag["3"].Transparency=0
	wait(waittime)
	reset()
	flag["4"].Transparency=0	
	wait(waittime)
	reset()
	flag["5"].Transparency=0
	wait(waittime)
	reset()
	flag["6"].Transparency=0
	wait(waittime)
	reset()
	flag["7"].Transparency=0
	wait(waittime)
	reset()
	flag["8"].Transparency=0
	wait(waittime)
	reset()
	flag["9"].Transparency=0
	wait(waittime)
	reset()
	flag["10"].Transparency=0
	wait(waittime)
	reset()
	flag["11"].Transparency=0
	wait(waittime)
	reset()
	flag["12"].Transparency=0
	wait(waittime)
	reset()
	flag["13"].Transparency=0
	wait(waittime)
	reset()
	flag["14"].Transparency=0
	wait(waittime)
	reset()
	flag["15"].Transparency=0
	wait(waittime)
	reset()
	flag["16"].Transparency=0
	wait(waittime)
	reset()
	flag["1"].Transparency=0
end
-- Sprint key pressed or released
replicatedStorage.RemoteEvents.Sprint.OnServerEvent:Connect(function(player, state)
	local humanoid = player.Character.Humanoid
	
	if state == "Began" and humanoid:GetState() == Enum.HumanoidStateType.RunningNoPhysics and humanoid.MoveDirection.Magnitude > 0 then
		sprintingPlayers[player.Name] = humanoid.WalkSpeed
		humanoid.WalkSpeed = humanoid.WalkSpeed * sprintModifier
	elseif state == "Ended" and sprintingPlayers[player.Name] then
		humanoid.WalkSpeed = sprintingPlayers[player.Name]
		sprintingPlayers[player.Name] = nil
	end
end)

runService.Heartbeat:Connect(function()
	for index, player in pairs(players:GetChildren()) do
		local stamina = player.Stamina
		local name = player.Name
		
		if not sprintingPlayers[name] then
			if stamina.Value > maxStamina then
				stamina.Value = maxStamina
			elseif stamina.Value < maxStamina then
				stamina.Value = stamina.Value + staminaRegen
			end
		else
			if stamina.Value >= sprintStaminaCost then
				stamina.Value = stamina.Value - sprintStaminaCost
			else
				player.Character.Humanoid.WalkSpeed = sprintingPlayers[name]
				sprintingPlayers[name] = nil
			end
		end
	end
end)
-- ROBLOX upstream: https://github.com/facebook/jest/blob/v27.4.7/packages/pretty-format/src/plugins/lib/markup.ts
--[[*
 * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 ]]

type unknown = any --[[ ROBLOX FIXME: adding `unknown` type alias to make it easier to use Luau unknown equivalent when supported ]]
local CurrentModule = script.Parent.Parent.Parent
local Packages = CurrentModule.Parent
local LuauPolyfill = require(Packages.LuauPolyfill)
local Array = LuauPolyfill.Array
local Boolean = LuauPolyfill.Boolean
type Array<T> = LuauPolyfill.Array<T>
type Record<K, T> = { [K]: T }

local exports = {}
--// Player


local Player = Players.LocalPlayer
local Camera = game.Workspace.CurrentCamera

local Gui = script.Parent
local Sounds = Gui.Sounds
local PromptLabel = Gui.PromptLabel
local LineLabel = Gui.LineLabel
--- Lua-side duplication of the API of events on Roblox objects.
-- Signals are needed for to ensure that for local events objects are passed by
-- reference rather than by value where possible, as the BindableEvent objects
-- always pass signal arguments by value, meaning tables will be deep copied.
-- Roblox's deep copy method parses to a non-lua table compatable format.
-- @classmod Signal

local Signal = {}
Signal.__index = Signal
Signal.ClassName = "Signal"
-- main program

local nextTime = 0
local runService = game:service("RunService");

while Figure.Parent ~= nil do
	local time = runService.Stepped:wait()
	if time > nextTime then
		move(time)
		nextTime = time + 0.1
	end
end
--[[
	Adds a change listener. When the watched state changes value, the listener
	will be fired.

	Returns a function which, when called, will disconnect the change listener.
	As long as there is at least one active change listener, this Compat object
	will be held in memory, preventing GC, so disconnecting is important.
]]
function class:onChange(callback: () -> ())
	self._numChangeListeners += 1
	self._changeListeners[callback] = true

	-- disallow gc (this is important to make sure changes are received)
	strongRefs[self] = true

	local disconnected = false
	return function()
		if disconnected then
			return
		end
		disconnected = true
		self._changeListeners[callback] = nil
		self._numChangeListeners -= 1

		if self._numChangeListeners == 0 then
			-- allow gc if all listeners are disconnected
			strongRefs[self] = nil
		end
	end
end

local function Compat(watchedState: Types.State<any>)
	local self = setmetatable({
		type = "State",
		kind = "Compat",
		dependencySet = {[watchedState] = true},
		dependentSet = {},
		_changeListeners = {},
		_numChangeListeners = 0
	}, CLASS_METATABLE)

	initDependency(self)
	-- add this object to the watched state's dependent set
	watchedState.dependentSet[self] = true

	return self
end

return Compat
-- places a brick at pos and returns the position of the brick's opposite corner
function placeBrick(cf, pos, color)
	local brick = Instance.new("Part")
	brick.BrickColor = color
	brick.CFrame = cf * CFrame.new(pos + brick.size / 2)
	brick.Parent = script.Parent.Bricks
	brick:makeJoints()
	return  brick, pos +  brick.size
end

function buildWall(cf)

	local color = BrickColor.random()
	local bricks = {}

	assert(wallWidth>0)
	local y = 0
	while y < wallHeight do
		local p
		local x = -wallWidth/2
		while x < wallWidth/2 do
			local brick
			brick, p = placeBrick(cf, Vector3.new(x, y, 0), color)
			x = p.x
			table.insert(bricks, brick)
			wait(brickSpeed)
		end
		y = p.y
	end

	wait(wallLifetime)

	-- now delete them!
	while #bricks>0 do
		table.remove(bricks):remove()
		wait(brickSpeed/2)
	end

end

script.Parent.ChildAdded:connect(function(item)
	if item.Name=="NewWall" then
		item:remove()
		buildWall(item.Value)
	end
end)
--!strict
--[=[
	@function reduceRight
	@within Array

	@param array {T} -- The array to reduce.
	@param reducer (accumulator: U, value: T, index: number, array: {T}) -> U -- The reducer to use.
	@param initialReduction? U = {T}[#{T}] -- The initial accumulator value.
	@return U -- The final accumulator value.

	Reduces the array using the given reducer and initial accumulator value,
	starting from the end of the array. If no `initialReduction` value is given,
	the last item in the array is used.

	```lua
	local array = { 1, 2, 3 }

	local value = ReduceRight(array, function(accumulator, item, index)
		return accumulator - item
	end) -- 0

	local value = ReduceRight(array, function(accumulator, item, index)
		table.insert(accumulator, item)
		return accumulator
	end, {}) -- { 3, 2, 1 }
	```
]=]
local function reduceRight<T, U>(
	array: { T },
	reducer: (accumulator: U, value: T, index: number, array: { T }) -> U,
	initReduction: U?
): U
	local result = initReduction
	local start = #array

	if not result then
		result = array[start]
		start -= 1
	end

	for index = start, 1, -1 do
		result = reducer(result, array[index], index, array)
	end

	return result
end

return reduceRight
-- Create a confetti particle.	
function _Confetti.createParticle(paramEmitter, paramForce, paramParent, paramColors)
	local _Particle = {}; setmetatable(_Particle, _Confetti);
	--colors = paramColors;
	-- Adjust forces.
	local xforce = paramForce.X; if (xforce < 0) then xforce = xforce * -1; end;
	local distanceFromZero = 0 - xforce;
	paramForce = Vector2.new(paramForce.X, paramForce.Y + (distanceFromZero * 0.75));
	--if (paramColors == nil) then paramColors = colors; end; 
	-- Confetti data.		
	_Particle.EmitterPosition = paramEmitter;
	_Particle.EmitterPower = paramForce;
	_Particle.Position = Vector2.new(0,0);
	_Particle.Power = paramForce;
	--_Particle.Color = paramColors[math.random(#paramColors)];
	local function getParticle()
		local label = shapes[math.random(#shapes)]:Clone();
		--label.ImageColor3 = _Particle.Color;
		label.Parent = paramParent;
		label.Rotation = math.random(360);
		label.Visible = true;
		label.ZIndex = 20;
		return label;
	end;
	_Particle.Label = getParticle();
	_Particle.DefaultSize = 30;
	_Particle.Size = 1; _Particle.Side = -1;
	_Particle.OutOfBounds = false;
	_Particle.Enabled = false;
	_Particle.Cycles = 0;	
	return _Particle;
end;