Roblox/luau_corpus huggingface dataset:
-- load it to the humanoid; get AnimationTrack
toolAnimTrack = humanoid:LoadAnimation(anim)
--[[
	wpcallPacked is a version of xpcall that:
	* Returns the length of the result first
	* Returns the result packed into a table
	* Passes extra arguments through to the passed function; xpcall doesn't
	* Issues a warning if PROMISE_DEBUG is enabled
]]
local function wpcallPacked(f, ...)
	local argsLength, args = pack(...)

	local body = function()
		return f(unpack(args, 1, argsLength))
	end

	local resultLength, result = pack(xpcall(body, debug.traceback))

	-- If promise debugging is on, warn whenever a pcall fails.
	-- This is useful for debugging issues within the Promise implementation
	-- itself.
	if PROMISE_DEBUG and not result[1] then
		warn(result[2])
	end

	return resultLength, result
end
-- === SOURCE ===

local Players = game:GetService("Players")
local DataStoreService = game:GetService("DataStoreService")

local dsPlayerBans = DataStoreService:GetDataStore("Bans")
--[[**
	ensures value is a table and all keys pass keyCheck and all values pass valueCheck

	@param keyCheck The function to use to check the keys
	@param valueCheck The function to use to check the values

	@returns A function that will return true iff the condition is passed
**--]]
function t.map(keyCheck, valueCheck)
	assert(t.callback(keyCheck))
	assert(t.callback(valueCheck))
	local keyChecker = t.keys(keyCheck)
	local valueChecker = t.values(valueCheck)

	return function(value)
		local keySuccess, keyErr = keyChecker(value)
		if not keySuccess then
			return false, keyErr or ""
		end

		local valueSuccess, valueErr = valueChecker(value)
		if not valueSuccess then
			return false, valueErr or ""
		end

		return true
	end
end
-- Public Functions
function WaypointPath:MoveTo()
	if self.currentIndex <= #self.waypoints then
		moveToAndWait(self.humanoid, self.waypoints[self.currentIndex].Position)
	else
		self._WaypointReachedEvent:Fire()
		return	
	end
	
	-- Next point
	self.currentIndex = self.currentIndex + 1
				
	-- Fire to listeners
	self._NodeReachedEvent:Fire()

	if self.count < 2 then
		-- Keep moving
		self.count = self.count + 1
		self:MoveTo()
	else
		self.count = 1
		self._FinishedMovingEvent:Fire()
	end
end

function WaypointPath:Stop()	
	self.humanoid:MoveTo(self.humanoidRoot.Position)
end


return WaypointPath
--Returns if a controller is connected.
local function ControllerConnected()
	return UserInputService:GetGamepadConnected(Enum.UserInputType.Gamepad1)
end
--- A helper that evaluates and runs the command in one go.
-- Either returns any validation errors as a string, or the output of the command as a string. Definitely a string, though.
function Dispatcher:EvaluateAndRun (text, executor, options)
	executor = executor or Players.LocalPlayer
	options = options or {}

	if RunService:IsClient() and options.IsHuman then
		self:PushHistory(text)
	end

	local command, errorText = self:Evaluate(text, executor, nil, options.Data)

	if not command then
		return errorText
	end

	local ok, out = pcall(function()
		local valid, errorText = command:Validate(true) -- luacheck: ignore

		if not valid then
			return errorText
		end

		return command:Run() or "Command executed."
	end)

	if not ok then
		warn(("Error occurred while evaluating command string %q\n%s"):format(text, out))
	end

	return ok and out or "An error occurred while running this command."
end
-- constants

local CHARACTER	= script.Parent
local HUMANOID	= CHARACTER.Humanoid
local ARMOR		= HUMANOID.Armor
local SLOTS		= HUMANOID.ArmorSlots

local SLOT_SIZE	= 30
--[[**
		Takes a table where keys are child names and values are functions to check the children against.
		Pass an instance tree into the function.
		If at least one child passes each check, the overall check passes.

		Warning! If you pass in a tree with more than one child of the same name, this function will always return false

		@param checkTable The table to check against

		@returns A function that checks an instance tree
	**--]]
	function t.children(checkTable)
		assert(checkChildren(checkTable))

		return function(value)
			local instanceSuccess, instanceErrMsg = t.Instance(value)
			if not instanceSuccess then
				return false, instanceErrMsg or ""
			end

			local childrenByName = {}
			for _, child in ipairs(value:GetChildren()) do
				local name = child.Name
				if checkTable[name] then
					if childrenByName[name] then
						return false, string.format("Cannot process multiple children with the same name %q", name)
					end

					childrenByName[name] = child
				end
			end

			for name, check in pairs(checkTable) do
				local success, errMsg = check(childrenByName[name])
				if not success then
					return false, string.format("[%s.%s] %s", value:GetFullName(), name, errMsg or "")
				end
			end

			return true
		end
	end
end

return t
-- constants

return function(character)
	local effects	= character.Effects
	local emitters	= {}
	
	local emitter1	= script.BaseEmitter:Clone()
		emitter1.Parent	= character.Head
		
	local emitter2	= script.FlameEmitter:Clone()
		emitter2.Parent	= character.Head
		
	wait(5)
	
	emitter1.Enabled	= false
	emitter2.Enabled	= false
	
	Debris:AddItem(emitter1, 2)
	Debris:AddItem(emitter2, 1)
end
-- for fading images
function UITween.fadePart(object, amount, time, delay)

	local tweenAlpha = TweenInfo.new(
		time, --Time
		Enum.EasingStyle.Quad, --EasingStyle
		Enum.EasingDirection.Out, --EasingDirection
		0, --Repeat count
		false, --Reverses if true
		delay --Delay time
	)

	local tween = tweenService:Create(object, tweenAlpha, {Transparency = amount})
	tween:Play()
end

function UITween.fade(object, amount, time, delay)
	
	local tweenAlpha = TweenInfo.new(
		time, --Time
		Enum.EasingStyle.Quad, --EasingStyle
		Enum.EasingDirection.Out, --EasingDirection
		0, --Repeat count
		false, --Reverses if true
		delay --Delay time
	)
	
	local tween = tweenService:Create(object, tweenAlpha, {ImageTransparency = amount})
	tween:Play()
end
--[=[
	@param fn ConnectionFn
	@return SignalConnection

	Connects a function to the signal, which will be called the next time the signal fires. Once
	the connection is triggered, it will disconnect itself.
	```lua
	signal:Once(function(msg, num)
		print(msg, num)
	end)

	signal:Fire("Hello", 25)
	signal:Fire("This message will not go through", 10)
	```
]=]
function Signal:Once(fn)
	local connection
	local done = false
	connection = self:Connect(function(...)
		if done then
			return
		end
		done = true
		connection:Disconnect()
		fn(...)
	end)
	return connection
end

function Signal:GetConnections()
	local items = {}
	local item = self._handlerListHead
	while item do
		table.insert(items, item)
		item = item._next
	end
	return items
end
--gun welds
local boltw = mainpart:WaitForChild("boltweld")
local magw = mainpart:WaitForChild("magweld")
local trigw = mainpart:WaitForChild("triggerweld")
local rightgrip
-- Initialize mesh tool
local MeshTool = require(CoreTools.MeshTool)
Core.AssignHotkey('H', Core.Support.Call(Core.EquipTool, MeshTool));
Core.Dock.AddToolButton(Core.Assets.MeshIcon, 'H', MeshTool, 'MeshInfo');
--		print("Wha " .. pose)
		stopAllAnimations()
		amplitude = 0.1
		frequency = 1
		setAngles = true
	end

	if (setAngles) then
		desiredAngle = amplitude * math.sin(time * frequency)

		RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)
		LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)
		RightHip:SetDesiredAngle(-desiredAngle)
		LeftHip:SetDesiredAngle(-desiredAngle)
	end

	-- Tool Animation handling
	local tool = getTool()
	if tool then
	
		animStringValueObject = getToolAnim(tool)

		if animStringValueObject then
			toolAnim = animStringValueObject.Value
			-- message recieved, delete StringValue
			animStringValueObject.Parent = nil
			toolAnimTime = time + .3
		end

		if time > toolAnimTime then
			toolAnimTime = 0
			toolAnim = "None"
		end

		animateTool()		
	else
		stopToolAnimations()
		toolAnim = "None"
		toolAnimInstance = nil
		toolAnimTime = 0
	end
end
-- ROBLOX TODO START: implement when possible
function picomatch.matchBase(input, glob, options, posix_: boolean?): boolean
	error("matchBase not implemented")
	-- local _posix = posix_ or utils.isWindows(options)

	-- local regex = if instanceof(glob, RegExp) then glob else picomatch.makeRe(glob, options)
	-- -- ROBLOX FIXME: return regex:test(path:basename(input))
	-- return regex:test(input)
end
-- Local Functions
local function moveToAndWait(humanoid, targetPosition)
	local targetReached = false
	local runningThread = coroutine.running()
	local connection1 = humanoid.MoveToFinished:Connect(function(reachedTarget)
		if reachedTarget then
			targetReached = true
			coroutine.resume(runningThread)
		end
	end)
	local connection2 = humanoid:GetPropertyChangedSignal("MoveDirection"):Connect(function()
		humanoid:MoveTo(targetPosition)
	end)
	humanoid:MoveTo(targetPosition)
	coroutine.wrap(function()
		while not targetReached do
			wait(6)
			if not humanoid.Parent or humanoid.WalkToPoint ~= targetPosition then
				break
			end
			humanoid:MoveTo(targetPosition)
		end    
	end)()
	coroutine.yield()
	connection1:Disconnect()
	connection2:Disconnect()
end
-- ROBLOX deviation end

type GetPath = {
	hasEndProp: boolean?,
	lastTraversedObject: any,
	traversedPath: Array<string>,
	value: any?,
}
-----------------------------------
_lights = getLights()
_signage = getSignage()

while true do
	local timeRemaining = updateState(tick(), _lights, _signage)
	wait(timeRemaining)
end
-- << SET UP PLAYER DATA >>
local getLimitPerMin = 6
local getRefreshInterval = 10
local getLimit = getLimitPerMin*(getRefreshInterval/60)
local getRequests = {}
spawn(function()
	while true do
		wait(getRefreshInterval)
		getRequests = {}
	end
end)
function module:GetData(caller, retries, userId)
	if not getRequests[caller] then
		getRequests[caller] = 0
	end
	getRequests[caller] = getRequests[caller] + 1
	if getRequests[caller] <= getLimit then
		local success, data = main:GetModule("DataStores"):GetData(playerDataStore, retries, userId)
		return success, data
	else
		--warn(caller.Name,"exeeded getLimit!")
	end
end


function module:SetupPlayerData(player)
	
	local dataTemplate = getDataTemplate()
	local success, pdata = self:GetData(player, datastoreRetries, player.UserId)
	
	--Can't access DataStore
	if not success and not main.isStudio then
		return nil
	
	--New player
	elseif not pdata then
		pdata = dataTemplate
		savePlayerData(player)
		local welcomeBadgeId = tonumber(main.settings.WelcomeBadgeId)
		if welcomeBadgeId and welcomeBadgeId > 0 then
			main.badgeService:AwardBadge(player.UserId, welcomeBadgeId)
		end
	
	--Existing player
	else
		for statName, statValue in pairs(dataTemplate) do
			if pdata[statName] == nil then
				pdata[statName] = statValue
			end
			if statName == "DefaultSettings" then
				for i, settingName in pairs(defaultSettingsToAdd) do
					if pdata[statName][settingName] == nil then
						pdata[statName][settingName] = settings[settingName]
					end
				end
			end
		end
		
	end
	
	main.pd[player] = pdata
	return pdata
end
-- Configurable variables
local attackCooldown = tool.Configurations.AttackCooldown.Value
local range = tool.Configurations.Range.Value
local damage = tool.Configurations.Damage.Value
local reloadTime = tool.Configurations.ReloadTime.Value
local clipSize = tool.Configurations.ClipSize.Value
-- Server:

function network:newEvent(name,callback)
	new("RemoteEvent",name).OnServerEvent:Connect(callback or blank);
end

function network:newFunction(name,callback)
	new("RemoteFunction",name).OnServerInvoke = callback or blank;
end

function network:fireClients(name,clients,...)
	local event = get(name);
	if(clients == "all") then
		event:FireAllClients(...);
	else
		for _,client in pairs(clients) do
			event:FireClient(client,...);
		end
	end
end
-- Start: Starts the clock
Start.OnInvoke = function(countDown)
	CountingDown = countDown
	LastTime = tick()
	Running = true
end
--PC
UIS.InputBegan:Connect(function(input)
	if input.UserInputType == Enum.UserInputType.MouseButton2 or input.UserInputType == Enum.UserInputType.MouseButton3  then
		Attack()
		Enable =false
		wait(cooldown)
		Enable = true
	end
	
end)
--[[ By: Brutez, 2/28/2015, 1:34 AM, (UTC-08:00) Pacific Time (US & Canada) ]]--
local PlayerSpawning=false; --[[ Change this to true if you want the NPC to spawn like a player, and change this to false if you want the NPC to spawn at it's current position. ]]--
local AdvancedRespawnScript=script;
repeat Wait(0)until script and script.Parent and script.Parent.ClassName=="Model";
local Ben=AdvancedRespawnScript.Parent;
if AdvancedRespawnScript and Ben and Ben:FindFirstChild("Thumbnail")then
Ben:FindFirstChild("Thumbnail"):Destroy();
end;
local GameDerbis=Game:GetService("Debris");
local BenHumanoid;
for _,Child in pairs(Ben:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then BenHumanoid=Child;
end;
end;
local Respawndant=Ben:Clone();
if PlayerSpawning then --[[ LOOK AT LINE: 2. ]]--
coroutine.resume(coroutine.create(function()
--[[**
	ensures Lua primitive callback type

	@param value The value to check against

	@returns True iff the condition is satisfied, false otherwise
**--]]
t.callback = primitive("function")
--// Bullet Physics
	BulletPhysics = Vector3.new(0,60,0); -- Drop fixation: Lower number = more drop
	BulletSpeed = 800; -- Bullet Speed
	BulletSpread = 0; -- How much spread the bullet has
	
	ExploPhysics = Vector3.new(0,20,0); -- Drop for explosive rounds
	ExploSpeed = 600; -- Speed for explosive rounds
	
	BulletDecay = 100000; -- How far the bullet travels before slowing down and being deleted (BUGGY)
--<< Gun Settings >>--

ToolName="M4A1"				-- The name of the tool, needed to be put for the script

ClipSize= 30				-- The amount of bullets that the player gets each time
ReloadTime= 3				-- How much time it takes to reload the gun in bullets (in seconds)
Firerate= .12				-- The rate of the gun
BaseDamage= 20				-- The damage that the gun does

automatic= true				-- Set true if the gun is an automatic type (miniguns, machine guns, etc)
burst= false				-- Set true if the gun is a burst type (shotguns, im too lasy :p )
shot= false					-- Set true if the gun is a shot type (snipers, pistols, etc)

MinSpread= .06
MaxSpread= .8
SpreadRate= .9

BarrlePos=Vector3.new(0,0,0)
Cursors={"rbxasset://textures\\GunCursor.png"}				-- The mouse cursor when the player equips the gun
ReloadCursor="rbxasset://textures\\GunWaitCursor.png"		-- The cursor when the player is reloading the gun
-- Arceusinator's Easing Functions
local function RevBack(t, b, c, d)
	t = 1 - t / d
	return c * (1 - (sin(t * 1.5707963267948965579989817342720925807952880859375) + (sin(t * 3.14159265358979311599796346854418516159057617187) * (cos(t * 3.14159265358979311599796346854418516159057617187) + 1) * 0.5))) + b
end

local function RidiculousWiggle(t, b, c, d)
	t = t / d
	return c * sin(sin(t * 3.14159265358979311599796346854418516159057617187) * 1.5707963267948965579989817342720925807952880859375) + b
end
-- Obtén el servicio de sonido
local soundService = game:GetService("SoundService")
--print(FRP-FLP)

	F = carSeat.AirPhysics 
	
	lv = carSeat.CFrame.lookVector
	uv = carSeat.CFrame.upVector
	rv = carSeat.CFrame.rightVector
	
	if carSeat.Velocity.Y > 0 then
		vy = carSeat.Velocity.Y*50
	else
		if carSeat.Velocity.Y*-70 > 7000 then
		vy = 7000
		else
		vy = carSeat.Velocity.Y*-70
		end
	end
	
	vx = carSeat.Velocity.X*-.5
	vz = carSeat.Velocity.Z*-.5
	
	F.Force = Vector3.new(vx, vy*1.4, vz)
	--print(F.Force)
avw = (carSeat.Parent.Parent.Wheels.FL.Wheel.Position.Y + carSeat.Parent.Parent.Wheels.FR.Wheel.Position.Y + carSeat.Parent.Parent.Wheels.RL.Wheel.Position.Y + carSeat.Parent.Parent.Wheels.RR.Wheel.Position.Y)/4
 if carSeat.Parent.Parent.RW.Pad.Position.Y < carSeat.Parent.Parent.RW.UPad.Position.Y then flpp = true
	count = count + 0.1
else
	count = 0 flpp = false
end

if speed < 3 then
	vlam = 3
else
	vlam = 17
end
if script.Parent.Storage.Autoflip.Value == true then
	if count > vlam then 
	carSeat.Flip.MaxTorque = Vector3.new(400000, 0, 400000) wait(0.5)
	else 
		carSeat.Flip.MaxTorque = Vector3.new(0, 0, 0)
	end
	else carSeat.Flip.MaxTorque = Vector3.new(0, 0, 0)
end
if avw + 2 < script.av.Value or avw - 2 > script.av.Value then
--[[

	LOWGames Studios
	Date: 27 October 2022
	by Elder
	
]]--

local u1 = nil;
coroutine.wrap(function()
	u1 = require(game.ReplicatedStorage:WaitForChild("Framework"):WaitForChild("Library"));
end)();
return function(p1, p2, p3, p4)
	if type(p1) ~= "table" then
		p1 = { p1 };
	end;
	local v1 = {};
	for v2, v3 in ipairs(p1) do
		if p3 == nil then
			p3 = { 1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out };
		else
			if p3[2] == nil then
				p3[2] = Enum.EasingStyle.Sine;
			elseif type(p3[2]) == "string" then
				if string.lower(p3[2]) == "expo" then
					p3[2] = Enum.EasingStyle.Exponential;
				else
					p3[2] = Enum.EasingStyle[p3[2]];
				end;
			end;
			if p3[3] == nil then
				p3[3] = Enum.EasingDirection.InOut;
			elseif type(p3[3]) == "string" then
				p3[3] = Enum.EasingDirection[p3[3]];
			end;
		end;
		local u2 = u1.TweenService:Create(v3, TweenInfo.new(unpack(p3)), p2);
		coroutine.wrap(function()
			if p4 then
				wait(p4);
			end;
			u2:Play();
		end)();
		table.insert(v1, u2);
	end;
	return unpack(v1);
end;
--// Bullet Physics
	BulletPhysics = Vector3.new(0,55,0); -- Drop fixation: Lower number = more drop
	BulletSpeed = 2750; -- Bullet Speed
	BulletSpread = 0; -- How much spread the bullet has
	
	ExploPhysics = Vector3.new(0,20,0); -- Drop for explosive rounds
	ExploSpeed = 600; -- Speed for explosive rounds
	
	BulletDecay = 10000; -- How far the bullet travels before slowing down and being deleted (BUGGY)
-- ROBLOX deviation: omitting _getSlots as it is specific to JS prototypes

function ModuleMockerClass:_ensureMockConfig(f): MockFunctionConfig
	local config = self._mockConfigRegistry[f]
	if not config then
		config = self:_defaultMockConfig()
		self._mockConfigRegistry[f] = config
	end

	return config
end
------------------------------------------------------------------------------------------------------------------------------
--// Static functions

local function getAlignMultiplier(enum)
	return (justify1[enum.Name] and 1) or (justify0[enum.Name] and 0) or 0.5;
end;

local function getClosestNumber(n, set)
	sort(set, function(a, b) return abs(n - a) < abs(n - b); end);
	return set[1];
end;
--// Damage Settings	
	BaseDamage = 36; -- Torso Damage
	LimbDamage = 30; -- Arms and Legs
	ArmorDamage = 30; -- How much damage is dealt against armor (Name the armor "Armor")
	HeadDamage = 43; -- If you set this to 100, there's a chance the player won't die because of the heal script
--[[
	PartCache V4.0 by Xan the Dragon // Eti the Spirit -- RBX 18406183
	Update V4.0 has added Luau Strong Type Enforcement.
	
	Creating parts is laggy, especially if they are supposed to be there for a split second and/or need to be made frequently.
	This module aims to resolve this lag by pre-creating the parts and CFraming them to a location far away and out of sight.
	When necessary, the user can get one of these parts and CFrame it to where they need, then return it to the cache when they are done with it.
	
	According to someone instrumental in Roblox's backend technology, zeuxcg (https://devforum.roblox.com/u/zeuxcg/summary)...
		>> CFrame is currently the only "fast" property in that you can change it every frame without really heavy code kicking in. Everything else is expensive.
		
		- https://devforum.roblox.com/t/event-that-fires-when-rendering-finishes/32954/19
	
	This alone should ensure the speed granted by this module.
		
		
	HOW TO USE THIS MODULE:
	
	Look at the bottom of my thread for an API! https://devforum.roblox.com/t/partcache-for-all-your-quick-part-creation-needs/246641
--]]
local table = require(script:WaitForChild("Table"))
--// Declarables
local CannonReload = false

local RotLeftKeyDown = false
local RotRightKeyDown = false

local IncreaseAltKeyDown = false
local DecreaseAltKeyDown = false

local Degrees = 0
local Degrees2 = 0
	local MaxDown = -5
	local MaxUp = 16

local ShellType
	ShellType = Settings.DefaultShell

local Aiming = false


if Settings.AimReticle ~= 0 then
	System.Gun.Retical.Decal.Texture = ("rbxassetid://"..Settings.AimReticle)
end
-- Bind drawer opening function to remote event
lamp.BoundingBox.ROBLOXInteractionEvent.OnServerEvent:connect(function(player, arguments)
	if player.Character and player.Character:FindFirstChild("Torso") then
		local torso = player.Character:FindFirstChild("Torso")
		local toTorso = torso.Position - lamp.BoundingBox.Position
		if toTorso.magnitude < clickDistance then
			lamp.Light.PointLight.Enabled = not lamp.Light.PointLight.Enabled
		end
	end
end)
--- Creates a link between two attachments. The module will constantly raycast between these two attachments.
-- @param attachment1 Attachment object (can have a group attribute)
-- @param attachment2 Attachment object
function Hitbox:LinkAttachments(attachment1: Attachment, attachment2: Attachment)
	local group: string? = attachment1:GetAttribute(DEFAULT_GROUP_NAME_INSTANCE)
	local point: Point = self:_CreatePoint(group, Hitbox.CastModes.LinkAttachments)

	point.Instances[1] = attachment1
	point.Instances[2] = attachment2
	table.insert(self.HitboxRaycastPoints, point)
end
-- helpers
local function printWarningMessage(target)
	local msg = table.concat({
		string.format("Could not locate %s.", target),
		string.format("Clientside error reporting disabled for %s", Players.LocalPlayer.Name),
	}, " ")
	warn(msg)
end
-- Don't edit if you don't know what you're doing --

local DataStoreService = game:GetService("DataStoreService")
local Players = game:GetService("Players")
local DataStore = DataStoreService:GetOrderedDataStore("GlobalLeaderboard_" .. statsName)
local Frame = script.Parent.Frame
local Contents = Frame.Contents
local Template = script.objTemplate

local COLORS = {
	Default = Color3.fromRGB(38, 50, 56),
	Gold = Color3.fromRGB(255, 215, 0),
	Silver = Color3.fromRGB(192, 192, 192),
	Bronze = Color3.fromRGB(205, 127, 50)
}
local ABBREVIATIONS = { "K", "M", "B", "T" }


local function toHumanReadableNumber(num)
	if num < 1000 then
		return tostring(num)
	end
	
	local digits = math.floor(math.log10(num)) + 1
	local index = math.min(#ABBREVIATIONS, math.floor((digits - 1) / 3))
	local front = num / math.pow(10, index * 3)
	
	return string.format("%i%s+", front, ABBREVIATIONS[index])
end

local function getItems()
	local data = DataStore:GetSortedAsync(false, maxItems, minValueDisplay, maxValueDisplay)
	local topPage = data:GetCurrentPage()

	Contents.Items.Nothing.Visible = #topPage == 0 and true or false

	for position, v in ipairs(topPage) do
		local userId = v.key
		local value = v.value
		local username = "[Not Available]"
		local color = COLORS.Default

		local success, err = pcall(function()
			username = Players:GetNameFromUserIdAsync(userId)
		end)

		if position == 1 then
			color = COLORS.Gold
		elseif position == 2 then
			color = COLORS.Silver
		elseif position == 3 then
			color = COLORS.Bronze
		end

		local item = Template:Clone()
		item.Name = username
		item.LayoutOrder = position
		item.Values.Number.TextColor3 = color
		item.Values.Number.Text = position
		item.Values.Username.Text = username
		item.Values.Value.Text = abbreviateValue and toHumanReadableNumber(value) or value
		item.Parent = Contents.Items
	end
end


script.Parent.Parent.Color = headingColor
Frame.Heading.ImageColor3 = headingColor
Frame.Heading.Bar.BackgroundColor3 = headingColor

while true do
	for _, player in pairs(Players:GetPlayers()) do
		local leaderstats = player:FindFirstChild("leaderstats")

		if not leaderstats then
			warn("Couldn't find leaderstats!")
			break
		end

		local statsValue = leaderstats:FindFirstChild(statsName)

		if not statsValue then
			warn("Couldn't find " .. statsName .. " in leaderstats!")
			break
		end

		pcall(function()
			DataStore:UpdateAsync(player.UserId, function()
				return tonumber(statsValue.Value)
			end)
		end)
	end

	for _, item in pairs(Contents.Items:GetChildren()) do
		if item:IsA("Frame") then
			item:Destroy()
		end
	end

	getItems()

	wait()
	Frame.Heading.Heading.Text = statsName .. " Leaderboard"
	Contents.GuideTopBar.Value.Text = statsName
	wait(updateEvery)
end