Roblox/luau_corpus huggingface dataset:
-- Leaderboard
function loadLeaderstats(player)
	local stats = Instance.new("IntValue")
	stats.Name = "leaderstats"

	local highScore = Instance.new("IntValue")
	highScore.Name = "High Score"
	highScore.Parent = stats
	highScore.Value = 0

	local currentScore = Instance.new("IntValue")
	currentScore.Name = "Score"
	currentScore.Parent = stats

	stats.Parent = player
end

function initialiseRunStats(player)
	if player:FindFirstChild("RunStats") then
		player.RunStats.Distance.Value = 0
		player.RunStats.CoinsCollected.Value = 0
	end
end

function showResults(player)
	local resultsGUI = game.ServerStorage.GUIs.PostRunGUI:Clone()
	resultsGUI.Frame.DistanceValue.Text = player.RunStats.Distance.Value
	resultsGUI.Frame.CoinsValue.Text = player.RunStats.CoinsCollected.Value
	resultsGUI.Frame.ScoreValue.Text = player.leaderstats.Score.Value

	resultsGUI.Parent = player.PlayerGui
	return resultsGUI
end

function initialiseNewRun(player, delayTime, charExpected, showLastResults)
	if not path then
		while not path do
			wait()
		end
	end

	local lastResultsGUI = nil
	if showLastResults then
		lastResultsGUI = showResults(player)
	end

	if delayTime ~= 0 then
		wait(delayTime)
	end

	if lastResultsGUI ~= nil then
		lastResultsGUI:Destroy()
	end

	if player and player.Parent then
		-- charExpected is needed to avoid calling LoadCharacter on players leaving the game
		if player.Character or charExpected == false then
			player:LoadCharacter()

			initialiseRunStats(player)

			local playersPath = path()
			lastActivePath[player.Name] = playersPath
			playersPath:init(player.Name)
		end
	end
end

function setUpPostRunStats(player)
	local folder = Instance.new("Folder")
	folder.Name = "RunStats"
	folder.Parent = player
	local currentDistance = Instance.new("IntValue")
	currentDistance.Name = "Distance"
	currentDistance.Value = 0
	currentDistance.Parent = folder
	local coinsCollected = Instance.new("IntValue")
	coinsCollected.Name = "CoinsCollected"
	coinsCollected.Value = 0
	coinsCollected.Parent = folder
end

function onPlayerEntered(player)
	player.CharacterAdded:connect(function(character)
		local humanoid = character:WaitForChild("Humanoid")
		if humanoid then
			humanoid.Died:connect(function()
				initialiseNewRun(player, 3, true, true)
			end)
		end
	end)

	-- Initial loading
	loadLeaderstats(player)
	setUpPostRunStats(player)

	-- Start game
	initialiseNewRun(player, 0, false, false)
end
game.Players.PlayerAdded:connect(onPlayerEntered)

function onPlayerRemoving(player)
	local track = game.Workspace.Tracks:FindFirstChild(player.Name)
	if track ~= nil then
		track:Destroy()
	end
end
game.Players.PlayerRemoving:connect(onPlayerRemoving)

for _, player in pairs(game.Players:GetChildren()) do
	onPlayerEntered(player)
end
-- parry 
end 


Tool.Enabled = true 

function onActivated() 

if not Tool.Enabled then 
return 
end 

Tool.Enabled = false 

local character = Tool.Parent; 
local humanoid = character.Humanoid 
if humanoid == nil then 
print("Humanoid not found") 
return 
end 

attack() 

wait(1) 

Tool.Enabled = true 
end 


function onEquipped() 

end 


script.Parent.Activated:connect(onActivated) 
script.Parent.Equipped:connect(onEquipped) 


connection = sword.Touched:connect(blow)
--[[
	Finds an empty canvas spot and returns it.

	Returns:
	- isSuccess (boolean): true if spot can be found, false if the canvas is full
]]
function Canvas:getEmptySpot()
	if self:isFull() then
		return false, constants.Errors.CanvasFull
	end

	local emptySpots = {}
	for _, spot in ipairs(self.spots) do
		if not spot:hasArt() then
			table.insert(emptySpots, spot)
		end
	end

	local spotIndex = self.rng:NextInteger(1, #emptySpots)

	return true, emptySpots[spotIndex]
end
--Check if player has access to panel, and copy the appropriate version to their PlayerGUI
function givePanel(player)
	for i, v in next, _G.panelAdmins do
		
		if i == player.UserId then

			local kick, ban, unban, shutdown, kill, broadcast = false, false, false, false, false, false
			
			for s in string.gmatch(v, "%a+") do
				if s == "kick" then
					kick = true
				elseif s == "ban" then
					ban = true
				elseif s == "unban" then
					unban = true
				elseif s == "shutdown" then
					shutdown = true
				elseif s == "kill" then
					kill = true
				elseif s == "broadcast" then
					broadcast = true
				end
			end
			
			local panel = script.PartnerPanelGui:Clone()
			
			if not kick then
				panel.MenuFrame.KickPlayer:Destroy()
				panel.KickMenuFrame:Destroy()
				panel.Events.KickFunction:Destroy()
			end
			
			if not ban then
				panel.MenuFrame.BanPlayer:Destroy()
				panel.BanMenuFrame:Destroy()
				panel.Events.BanFunction:Destroy()
			end
			
			if not unban then
				panel.MenuFrame.UnbanPlayer:Destroy()
				panel.UnbanMenuFrame:Destroy()
				panel.Events.UnbanFunction:Destroy()
			end			
			
			if not shutdown then
				panel.MenuFrame.ShutdownServer:Destroy()
				panel.Events.ShutdownEvent:Destroy()
			end
			
			if not kill then
				panel.MenuFrame.KillPlayer:Destroy()
				panel.KillMenuFrame:Destroy()
				panel.Events.KillFunction:Destroy()
			end
			
			if not broadcast then
				panel.MenuFrame.BroadcastMessage:Destroy()
				panel.BroadcastMenuFrame:Destroy()
				panel.Events.BroadcastEvent:Destroy()
			end
			
			panel.Parent = player.PlayerGui
			
			break
		end
	end
end

function thread()
	
	while true do
		if workspace.FilteringEnabled == false then
	
			script:Remove()
			warn("FilteringEnabled is required to run the Kaixeleron admin panel.")
			break
	
		end
		
		wait()
	end
end

spawn(thread)
--[=[
	@within Plasma
	@function row
	@tag widgets
	@param options {padding: Vector2}
	@param children () -> () -- Children

	Lays out children horizontally
]=]

local Runtime = require(script.Parent.Parent.Runtime)
local automaticSize = require(script.Parent.Parent.automaticSize)

return Runtime.widget(function(options, fn)
	if type(options) == "function" and fn == nil then
		fn = options
		options = {}
	end

	if options.padding then
		if type(options.padding) == "number" then
			options.padding = UDim.new(0, options.padding)
		end
	else
		options.padding = UDim.new(0, 10)
	end

	local refs = Runtime.useInstance(function(ref)
		local Frame = Instance.new("Frame")
		Frame.BackgroundTransparency = 1

		local UIListLayout = Instance.new("UIListLayout")
		UIListLayout.SortOrder = Enum.SortOrder.LayoutOrder
		UIListLayout.FillDirection = Enum.FillDirection.Horizontal
		UIListLayout.Padding = options.padding
		UIListLayout.Parent = Frame

		ref.frame = Frame

		automaticSize(Frame)

		return Frame
	end)

	local frame = refs.frame

	frame.UIListLayout.HorizontalAlignment = options.alignment or Enum.HorizontalAlignment.Left

	Runtime.scope(fn)
end)
-- You may turn both of these on at once. In that case, zone-specific music will play in the appropriate zones, and global background music will play whenever you're not within any zone.
settings.UseGlobalBackgroundMusic = true  -- If you want to play Global Background Music for everyone in your game, set this to true.
settings.UseMusicZones = true  -- If you are using the Background Music Zones to play specific music in certain areas, set this to true.

settings.DisplayMuteButton = true  -- If set to true, there will be a button in the bottom-right corner of the screen allowing players to mute the background music.
settings.MusicFadeoutTime = 2  -- How long music takes to fade out, in seconds.
settings.MusicOnlyPlaysWithinZones = false  -- (This setting only applies when UseGlobalBackgroundMusic is set to false) If a player walks into an area that's not covered by any music zone, what should happen? If true, music will stop playing. If false, the music from the previous zone will continue to play.

return settings
-- Public Constructors

function RadioButtonLabelClass.new(frame)
	local self = setmetatable({}, RadioButtonLabelClass)
	
	self._Maid = Lazy.Utilities.Maid.new()
	
	self.Frame = frame
	self.Button = frame.RadioContainer.RadioButton
	
	init(self)
	self:SetValue(false)
	
	return self
end

function RadioButtonLabelClass.Create(text)
	local cbLabel = RADIOBUTTON_LABEL:Clone()
	cbLabel.Label.Text = text
	return RadioButtonLabelClass.new(cbLabel)
end
-- Connect the "leaderboardSetup()" function to the "PlayerAdded" event
Players.PlayerAdded:Connect(leaderboardSetup)
--------------------) Settings
Damage = 0 -- the ammout of health the player or mob will take

Cooldown = 5 -- cooldown for use of the tool again

ZoneModelName = "OwO broke ground" -- name the zone model

MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage
--PROBABLY WOULDNT TOUCH ABOVE UNLESS YOU KNOW WHAT YOURE DOING

Tool.Equipped:Connect(function()

	CheckTables() --Check if Table with list of Sounds and Animations are made. If not, make them. Please do not delete this
	
	CanSwing = false

	if Settings.EquipAnim == true and Tool.Animations:findFirstChild("Equip") and Hum then --if equip animation true and requirements are met, do this
		local EA = Chr.Humanoid:LoadAnimation(Tool.Animations.Equip)
		EA:Play()
		if Tool.Sounds:findFirstChild("Equip") then
			Tool.Sounds.Equip:Play()
		end
		EA.Stopped:wait()
	elseif Settings.EquipAnim == true then --if equip is true but you're missing an animation, print that so we know
		print(Plr.Name .. "'s equip animation failed, requirement not met.")
	end
	
	CanSwing = true

end)

Tool.Activated:Connect(function()
	
	if CanSwing == true and Hum.Health > 0 then --if youre able to swing and you arent dead
	
		CanSwing = false
		CanDamage = true
		local Swing = PickThing("Swing")
		local Sound = PickThing("Sound")
		
		--go though swings if more than one
		local SA = Hum:LoadAnimation(Swing)
		SA:Play()
		Sound:Play()
		
		wait(Settings.Cooldown)
		
		CanDamage = false
		CanSwing = true
		
	end
	
end)

Tool.Unequipped:Connect(function()
	
	CanSwing = false
	CanDamage = false
	
end)

Settings.Hitbox.Touched:Connect(function(Hit)
	local Mod = Hit.Parent

	if CanDamage == true then
		while not Mod:FindFirstChild("Humanoid") and Mod.Parent ~= game do
			Mod = Mod.Parent
		end
		local Hum = Mod:FindFirstChild("Humanoid")

		if game.Players:findFirstChild(Hum.Parent.Name) then
		else
			if Settings.KillNPCs == true then
				-- Check if target is not already dead
				if Hum.Health > 0 then
					Hum:TakeDamage(Settings.Damage)
					CanDamage = false

					-- Check if target is now dead
					if Hum.Health <= 0 then
						-- Increment Plr.leaderstats.Kills.Value by 1
						Plr.leaderstats.Kills.Value = Plr.leaderstats.Kills.Value + 1
					end
				end
			else
				return
			end
		end
	end
end)
--[[ Script Variables ]]--
while not Players.LocalPlayer do
	wait()
end
local LocalPlayer = Players.LocalPlayer
local CachedHumanoid = nil
local DPadFrame = nil
local TouchObject = nil
local OnInputEnded = nil		-- defined in Create()
-- << VARIABLES >>
local frame = main.gui.MainFrame.Pages.About
local info = frame.Info
local updatesFrame = frame.Updates
local creditsFrame = frame.Credits
-- Components
local ScopeOutTooltip = require(script:WaitForChild 'ScopeOutTooltip')
local ScopeLockTooltip = require(script:WaitForChild 'ScopeLockTooltip')
local ScopeInTooltip = require(script:WaitForChild 'ScopeInTooltip')
local AltTooltip = require(script:WaitForChild 'AltTooltip')

local function HotkeyTooltip(props)
    local Tooltip = nil

    -- Select appropriate tooltip
    if props.IsAltDown then
        if props.IsScopeParent then
            Tooltip = Roact.createElement(ScopeOutTooltip, props)
        elseif props.IsScope and (not props.IsScopeLocked) then
            Tooltip = Roact.createElement(ScopeLockTooltip, props)
        elseif props.IsScopable then
            Tooltip = Roact.createElement(ScopeInTooltip, props)
        end
    elseif props.DisplayAltHotkey then
        Tooltip = Roact.createElement(AltTooltip, props)
    end

    -- Return tooltip with spacer
    return Roact.createFragment({
        Tooltip = Tooltip;
        Spacer = Tooltip and Roact.createElement('Frame', {
            BackgroundTransparency = 1;
            Size = UDim2.new(0, 0, 1, 0);
            LayoutOrder = props.LayoutOrder and (props.LayoutOrder - 1) or 2;
        });
    })
end

return HotkeyTooltip
--[=[
	Converts a table to a list.

	@param _table table -- Table to convert to a list
	@return table
]=]
function Table.toList(_table)
	local list = {}
	for _, item in pairs(_table) do
		table.insert(list, item)
	end
	return list
end
--[=[
	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.

	This class is designed to work both in deferred mode and in regular mode.
	It follows whatever mode is set.

	```lua
	local signal = Signal.new()

	local arg = {}

	signal:Connect(function(value)
		assert(arg == value, "Tables are preserved when firing a Signal")
	end)

	signal:Fire(arg)
	```

	:::info
	Why this over a direct [BindableEvent]? Well, in this case, the signal
	prevents Roblox from trying to serialize and desialize each table reference
	fired through the BindableEvent.
	:::

	@class Signal
]=]

local HttpService = game:GetService("HttpService")

local ENABLE_TRACEBACK = false

local Signal = {}
Signal.__index = Signal
Signal.ClassName = "Signal"
--// updated by bus, because this man's code is garbage.
--// Config
local Sensitivity = 1.5 -- how quick/snappy the Sway movements are. Don't go above 2
local SwaySize = 1 -- how large/powerful the Sway is. Don't go above 2
local IncludeStrafe = false -- if true the fps arms will Sway when the Character is strafing
local IncludeWalkSway = true -- if true, fps arms will Sway when you are walking
local IncludeCameraSway = true -- if true, fps arms will Sway when you move the camera
local IncludeJumpSway = true -- if true, jumping will have an effect on the Viewmodel
local HeadOffset = Vector3.new(0,0,0) -- the offset from the default camera position of the head. (0,1,0) will put the camera one stud above the head.
local baseArmTransparency = 0 -- the transparency of the arms in first person; set to 1 for invisible and set to 0 for fully visible.
--======================================--
--==============Weld Parents(WPR)==============--
--======================================--
w1.Parent = bin.Handle
w2.Parent = bin.Handle
w3.Parent = bin.Handle
w4.Parent = bin.Handle
w5.Parent = bin.Handle
w6.Parent = bin.Handle
w7.Parent = bin.Handle
w8.Parent = bin.Handle
w9.Parent = bin.Handle
w10.Parent = bin.Handle
w11.Parent = bin.Handle
w12.Parent = bin.Handle
-------------------
---[[Functions]]---
-------------------

local function HasProperty(object, prop)
	local success, val = pcall(function()
		return object[prop]
	end)

	return success and val ~= object:FindFirstChild(prop)
end
-- FOLDERS --
local Modules = RS:WaitForChild("Modules")
local Remotes = RS:WaitForChild("Remotes")
local Hitboxes = RS:WaitForChild("Hitboxes")
local FX = RS:WaitForChild("FX")
local Sounds = RS:WaitForChild("Sounds")
--[[
	Recursively iterates through the object to construct strings and add it to the localization table
	@param localeId string -- The localizationid to add
	@param baseKey string -- the key to add
	@param object any -- The value to iterate over
]]
local function recurseAdd(localizationTable, localeId, baseKey, object)
	if baseKey ~= "" then
		baseKey = baseKey .. "."
	end

	for index, value in pairs(object) do
		local key = baseKey .. index
		if type(value) == "table" then
			recurseAdd(localizationTable, localeId, key, value)
		elseif type(value) == "string" then
			local source = ""
			local context = ""

			if localeId == "en" then
				source = value
			end

			localizationTable:SetEntryValue(key, source, context, localeId, value)
		else
			error("Bad type for value in '" .. key .. "'.")
		end
	end
end
--[[Engine]]
	--Torque Curve
	Tune.Horsepower		= 600		--	[TORQUE CURVE VISUAL]
	Tune.IdleRPM		= 1090		--		https://www.desmos.com/calculator/2uo3hqwdhf
	Tune.PeakRPM		= 5400		--		Use sliders to manipulate values
	Tune.Redline		= 6700		--		Copy and paste slider values into the respective tune values
	Tune.EqPoint		= 5500
	Tune.PeakSharpness	= 7.5
	Tune.CurveMult		= 0.16
	
	--Incline Compensation
	Tune.InclineComp	= 4.7			-- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
	
	--Misc
	Tune.RevAccel		= 150		-- RPM acceleration when clutch is off
	Tune.RevDecay		= 75		-- RPM decay when clutch is off
	Tune.RevBounce		= 500		-- RPM kickback from redline
	Tune.IdleThrottle	= 3			-- Percent throttle at idle
	Tune.ClutchTol		= 500		-- Clutch engagement threshold (higher = faster response)
--[[
	Package link auto-generated by Rotriever
]]
local PackageIndex = script.Parent.Parent._Index

local Package = require(PackageIndex["CollisionMatchers2D"]["CollisionMatchers2D"])

return Package
--Evento animación de muerte
Humanoid.HealthChanged:Connect(function(Health) 
	if Health <= 0 then
		
		script.Parent.HumanoidRootPart.Anchored = true
		DeathAnimation:Play() 
		
		wait(1.20) --Aquí colocar tiempo para que empieze a desaparecer el NPC
		
		for i, v in pairs( NPC:GetDescendants()) do
			
			if v:IsA("Part") or v:IsA("BasePart") or v:IsA("MeshPart") or v:IsA("Decal") then
				local deathFade = TweenService:Create(v, TweenInfo.new(0.4), {Transparency = 1})
				deathFade:Play()
			end
		end
		
		wait(0.5)
		NPC:Remove()
		
		wait(4) --Aquí colocar tiempo para que el NPC haga respawn
		
		newNPC.Parent = game.Workspace
	end
end)
-- Local Variables
local TimeObject = game.Workspace:WaitForChild('MapPurgeProof'):WaitForChild('Time')
local ScreenGui = script.Parent.ScreenGui
local Timer = ScreenGui.ScoreFrame.Timer
local Events = game.ReplicatedStorage.Events
local DisplayTimerInfo = Events.DisplayTimerInfo
--------------------------------------------------------------------------

local _WHEELTUNE = {
																		--[[	
			SS6 Presets
	[Eco]		
		WearSpeed = 1,
		TargetFriction = .7,
		MinFriction = .1,
	[Road]		
		WearSpeed = 2,
		TargetFriction = .7,
		MinFriction = .1,
	[Sport]		
		WearSpeed = 3,
		TargetFriction = .79,
		MinFriction = .1,											]]

	TireWearOn 		= true	,
	
	--Friction and Wear
	FWearSpeed		= .8	,
	FTargetFriction	= 0.93	,
	FMinFriction 	= .1	,
	
	RWearSpeed		= .8	,
	RTargetFriction	= 0.97	,
	RMinFriction	= .1	,
	
	--Tire Slip
	TCSOffRatio		= 1/3	,
	WheelLockRatio	= 1/2	,	--SS6 Default = 1/4
	WheelspinRatio	= 1/1.1	,	--SS6 Default = 1/1.2
	
	--Wheel Properties
	FFrictionWeight	= 1		,	--SS6 Default = 1
	RFrictionWeight	= 1		,	--SS6 Default = 1
	FLgcyFrWeight	= 10	,
	RLgcyFrWeight	= 10	,
	
	FElasticity		= .5		,	--SS6 Default = .5
	RElasticity		= .5		,	--SS6 Default = .5
	FLgcyElasticity	= 0		,
	RLgcyElasticity	= 0		,
	
	FElastWeight	= 1		,	--SS6 Default = 1
	RElastWeight	= 1		,	--SS6 Default = 1
	FLgcyElWeight	= 10	,
	RLgcyElWeight	= 10	,
	
	--Wear Regen
	RegenSpeed		= 3.6		--SS6 Default = 3.6
}
-- Get reference to the Dock frame
local dock = script.Parent.Parent.AdmDockShelf
--Set up firing the rocket.
FireRocketEvent.OnServerEvent:Connect(function(Player)
	if Player == CurrentPlayer and ToolEnabled then
		ToolEnabled = false
		Tool.Enabled = false
		CurrentRocket = RocketBuffer:PopItem() or CurrentRocket
		
		local FiredBy = Instance.new("ObjectValue")
		FiredBy.Name = "FiredBy"
		FiredBy.Value = Player
		FiredBy.Parent = CurrentRocket
		
		wait(ROCKET_RELOAD_TIME)
		AddBufferRocket()
		ToolEnabled = true
		Tool.Enabled = true
	end
end)
--s.Pitch = 0.7
while s.Pitch<0.65 do
s.Pitch=s.Pitch+0.009
s:Play()
if s.Pitch>1 then
	s.Pitch=1
end
wait(-9)
end

while s.Pitch<0.97 do
s.Pitch=s.Pitch+0.003
s:Play()
if s.Pitch>1 then
	s.Pitch=1
end
wait(-9)
end
--[[
	SoftShutdown 1.2
	Author: Merely
	
	This systesm lets you shut down servers without losing a bunch of players.
	When game.OnClose is called, the script teleports everyone in the server
	into a reserved server.
	
	When the reserved servers start up, they wait a few seconds, and then
	send everyone back into the main place.
	
	I added wait() in a couple of places because if you don't, everyone will spawn into
	their own servers with only 1 player.
--]]

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

if (game.VIPServerId ~= "" and game.VIPServerOwnerId == 0) then
	-- this is a reserved server without a VIP server owner
	local m = Instance.new("Message")
	m.Text = "This is a temporary lobby. Teleporting back in a moment."
	m.Parent = workspace
	
	local waitTime = 5

	Players.PlayerAdded:connect(function(player)
		wait(waitTime)
		waitTime = waitTime / 2
		TeleportService:Teleport(game.PlaceId, player)
	end)
	
	for _,player in pairs(Players:GetPlayers()) do
		TeleportService:Teleport(game.PlaceId, player)
		wait(waitTime)
		waitTime = waitTime / 2
	end
else
	game:BindToClose(function()
		if (#Players:GetPlayers() == 0) then
			return
		end
		
		if (game.JobId == "") then
			-- Offline
			return
		end
		
		
		local DataStore2 = require(game.ServerScriptService.MainModule)
		for _,player in pairs(Players:GetPlayers()) do
			local data = DataStore2("Stats",player):Get()
			DataStore2("Stats",player):Update(function(old)
				return data
			end)
		end
		
		
		local m = Instance.new("Message")
		m.Text = "Rebooting servers for update. Please wait"
		m.Parent = workspace
		wait(2)
		local reservedServerCode = TeleportService:ReserveServer(game.PlaceId)
		
		for _,player in pairs(Players:GetPlayers()) do
			TeleportService:TeleportToPrivateServer(game.PlaceId, reservedServerCode, { player })
		end
		Players.PlayerAdded:connect(function(player)
			TeleportService:TeleportToPrivateServer(game.PlaceId, reservedServerCode, { player })
		end)
		while (#Players:GetPlayers() > 0) do
			wait(1)
		end	
		
		-- done
	end)
end
-- SERVICES --
local UIS = game:GetService("UserInputService")
local RS = game:GetService("ReplicatedStorage")
local TS = game:GetService("TweenService")
local CS = game:GetService("CollectionService")
--!strict
local function lastIndexOf(str: string, searchValue: string, fromIndex: number?): number
	local strLength = string.len(str)
	local calculatedFromIndex
	if fromIndex then
		calculatedFromIndex = fromIndex
	else
		calculatedFromIndex = strLength
	end
	if fromIndex and fromIndex < 1 then
		calculatedFromIndex = 1
	end
	if fromIndex and fromIndex > strLength then
		calculatedFromIndex = strLength
	end
	if searchValue == "" then
		-- FIXME: Luau DFA doesn't understand that
		return calculatedFromIndex :: number
	end

	local lastFoundStartIndex, foundStartIndex
	-- Luau FIXME: Luau doesn't look beyond assignment for type, it should infer number? from loop bound
	local foundEndIndex: number? = 0
	repeat
		lastFoundStartIndex = foundStartIndex
		-- Luau FIXME: DFA doesn't understand until clause means foundEndIndex is never nil within loop
		foundStartIndex, foundEndIndex = string.find(str, searchValue, foundEndIndex :: number + 1, true)
	until foundStartIndex == nil or foundStartIndex > calculatedFromIndex

	if lastFoundStartIndex == nil then
		return -1
	end
	-- Luau FIXME: Luau should see the predicate above and known the line below can only be a number
	return lastFoundStartIndex :: number
end

return lastIndexOf
-- << REMOTE LIMITS / SANITY CHECKS >>
local remoteRefreshRate = 5
local remoteLimits = {
	["RemoteFunction"] = 20;
	["RemoteEvent"] = 10;
}
local sanityChecks = {}

local function checkRemoteLimit(player, remote)
	local remoteType = remote.ClassName
	local remoteLimit = remoteLimits[remoteType]
	if not sanityChecks[player] then
		sanityChecks[player] = {}
	end
	local requests = sanityChecks[player][remote]
	if not requests then
		requests = 1
		sanityChecks[player][remote] = requests
	else
		sanityChecks[player][remote] = requests + 1
	end
	if requests > remoteLimit then
		main:GetModule("cf"):FormatAndFireError(player, "RequestsLimit")
		if remoteType == "RemoteFunction" then
			wait(1)
		end
		return false
	end
	return true
end

coroutine.wrap(function()
	while true do
		wait(remoteRefreshRate)
		sanityChecks = {}
	end
end)()