function.lua

publicluau remote loaderupdated
loadstring(game:HttpGet("https://pasteblox.com/raw/87b7cj24z3"))()
pbx pull 87b7cj24z3raw link never changes · v4 live

what's new in v4

· @biantca

Fixing Auto Next Buy

function-lua.luau
codediff
-- FunctionFramework v3 (Roblox)
-- Semua pencarian (path, nama, class, attribute, player, tool, remote) TIDAK peka huruf besar/kecil.
-- "world1.tower.pad" = "World1.Tower.Pad" = "WORLD1.tower.PAD"
--
-- local fc = loadstring(game:HttpGet("URL_RAW_KAMU"))()
-- local inst, path = fc.findPath("world1.tower.pad")
-- print(path)  --> workspace.Maps.World1.Tower.Folder.Pad
--
-- Tiap bagian path dicari di mana pun di dalam bagian sebelumnya.
-- Hasil pencarian disimpan di cache supaya pencarian berikutnya instan.
-- Nama fungsi juga tidak peka huruf: fc.findPath == fc.FindPath

local FC = {}
FC.version = 3

-- ============================================
-- SERVICES
-- ============================================
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")
local HttpService = game:GetService("HttpService")

local LP = Players.LocalPlayer
FC.LocalPlayer = LP

local function isInst(x)
	return typeof(x) == "Instance"
end

local function lower(x)
	return tostring(x):lower()
end

-- Lokasi yang dipindai saat mencari berdasarkan nama
local SEARCH_ROOTS = {
	workspace,
	game:GetService("ReplicatedStorage"),
	game:GetService("Players"),
	game:GetService("Lighting"),
	game:GetService("StarterGui"),
	game:GetService("StarterPack"),
	game:GetService("ReplicatedFirst"),
}

local function toPath(inst)
	local full = inst:GetFullName()
	return (full:gsub("^Workspace", "workspace"))
end

-- Cek class tanpa peduli huruf besar/kecil ("basepart" = "BasePart")
local function classOk(inst, class)
	if not class then return true end
	local ok, res = pcall(inst.IsA, inst, class)
	if ok and res then return true end
	local ok2, res2 = pcall(inst.IsA, inst, class:sub(1, 1):upper() .. class:sub(2))
	if ok2 and res2 then return true end
	return inst.ClassName:lower() == lower(class)
end

-- Cari attribute tanpa peduli huruf besar/kecil, kembalikan nama asli
local function realAttrName(inst, name)
	if inst:GetAttribute(name) ~= nil then return name end
	local low = lower(name)
	for k in pairs(inst:GetAttributes()) do
		if k:lower() == low then return k end
	end
	return nil
end

-- ============================================
-- 1. UTIL DASAR
-- ============================================
function FC.safe(fn, ...)
	local r = table.pack(pcall(fn, ...))
	if r[1] then
		return true, table.unpack(r, 2, r.n)
	end
	return false, r[2]
end

function FC.retry(fn, times, delay)
	times = times or 3
	delay = delay or 0.3
	local lastErr
	for _ = 1, times do
		local ok, res = pcall(fn)
		if ok and res ~= nil and res ~= false then return res end
		lastErr = res
		task.wait(delay)
	end
	return nil, lastErr
end

function FC.waitFor(cond, timeout, step)
	timeout = timeout or 10
	step = step or 0.1
	local t0 = os.clock()
	while os.clock() - t0 < timeout do
		local ok, res = pcall(cond)
		if ok and res then return res end
		task.wait(step)
	end
	return nil
end

function FC.debounce(fn, wait)
	wait = wait or 0.3
	local last = 0
	return function(...)
		local now = os.clock()
		if now - last >= wait then
			last = now
			return fn(...)
		end
	end
end

function FC.loop(fn, interval)
	interval = interval or 0.1
	local running = true
	task.spawn(function()
		while running do
			pcall(fn)
			task.wait(interval)
		end
	end)
	return function() running = false end
end

-- ============================================
-- 2. STRING
-- ============================================
function FC.split(str, sep)
	local out = {}
	if type(str) ~= "string" then return out end
	sep = sep or "."
	local pattern = "([^" .. sep:gsub("%p", "%%%0") .. "]+)"
	for part in string.gmatch(str, pattern) do
		table.insert(out, part)
	end
	return out
end

function FC.trim(str)
	local s = tostring(str):gsub("^%s+", "")
	s = s:gsub("%s+$", "")
	return s
end

function FC.contains(str, sub, caseSensitive)
	str, sub = tostring(str), tostring(sub)
	if not caseSensitive then str, sub = str:lower(), sub:lower() end
	return str:find(sub, 1, true) ~= nil
end

function FC.startsWith(str, prefix)
	return lower(str):sub(1, #prefix) == lower(prefix)
end

function FC.endsWith(str, suffix)
	return suffix == "" or lower(str):sub(-#suffix) == lower(suffix)
end

function FC.formatNumber(n)
	n = tonumber(n)
	if not n then return "0" end
	local s = tostring(math.floor(n))
	local rev = s:reverse():gsub("(%d%d%d)", "%1,")
	local out = rev:reverse()
	out = out:gsub("^,", "")
	return out
end

function FC.parseNumber(str)
	if type(str) == "number" then return str end
	local s = tostring(str):lower():gsub(",", "")
	s = s:gsub("%s+", "")
	local num, suffix = s:match("^([%d%.]+)(%a*)$")
	num = tonumber(num)
	if not num then return nil end
	local mult = {k = 1e3, m = 1e6, b = 1e9, t = 1e12}
	return num * (mult[suffix] or 1)
end

-- ============================================
-- 3. PATH & FIND (SEMUA LOWERCASE)
-- ============================================
local pathCache = {}

function FC.clearCache()
	pathCache = {}
end

-- Anak langsung dengan nama (abaikan huruf besar/kecil)
local function childLower(parent, lowName)
	for _, c in ipairs(parent:GetChildren()) do
		if c.Name:lower() == lowName then return c end
	end
	return nil
end

local function strictChild(parent, lowName)
	if parent == game then
		if lowName == "workspace" then return workspace end
		for _, svc in ipairs(game:GetChildren()) do
			if svc.Name:lower() == lowName then return svc end
		end
		return nil
	end
	return childLower(parent, lowName)
end

-- Path lengkap persis dari root (cepat)
local function strictResolve(parts, start)
	local current = start or game
	for _, part in ipairs(parts) do
		current = strictChild(current, part)
		if not current then return nil end
	end
	return current
end

-- Kandidat: anak langsung dulu, lalu semua keturunan
local function candidates(parent, lowName)
	local list, deep = {}, {}
	for _, c in ipairs(parent:GetChildren()) do
		if c.Name:lower() == lowName then table.insert(list, c) end
	end
	for _, d in ipairs(parent:GetDescendants()) do
		if d.Parent ~= parent and d.Name:lower() == lowName then
			table.insert(deep, d)
		end
	end
	for _, d in ipairs(deep) do table.insert(list, d) end
	return list
end

-- Telusuri bagian path berikutnya (dengan backtracking)
local function resolveDeep(parent, parts, idx, results, limit, class)
	for _, cand in ipairs(candidates(parent, parts[idx])) do
		if idx == #parts then
			if classOk(cand, class) then
				table.insert(results, cand)
				if #results >= limit then return true end
			end
		else
			if resolveDeep(cand, parts, idx + 1, results, limit, class) then
				return true
			end
		end
	end
	return false
end

local function smartFind(parts, roots, limit, class)
	local results = {}
	for _, root in ipairs(roots) do
		if root then
			local first = {}
			if root.Name:lower() == parts[1]
				or (root == workspace and parts[1] == "workspace") then
				table.insert(first, root)
			end
			for _, c in ipairs(candidates(root, parts[1])) do
				table.insert(first, c)
			end
			for _, cand in ipairs(first) do
				if #parts == 1 then
					if classOk(cand, class) then table.insert(results, cand) end
				else
					resolveDeep(cand, parts, 2, results, limit, class)
				end
				if #results >= limit then return results end
			end
		end
	end
	return results
end

-- Pecah path jadi bagian huruf kecil
local function parsePath(path)
	local sep = path:find("/", 1, true) and "/" or "."
	local parts = FC.split(path:lower(), sep)
	if #parts > 1 and parts[1] == "game" then
		table.remove(parts, 1)
	end
	return parts
end

local function parseArgs(arg2)
	if isInst(arg2) then return {root = arg2} end
	if type(arg2) == "table" then return arg2 end
	return {}
end

local function getRoots(opts)
	if opts.root then
		local r = isInst(opts.root) and opts.root or FC.findPath(opts.root)
		return r and {r} or {}
lines 1–300 of 1,612open raw find-in-page only searches the lines loaded so far. "show all" loads the rest.

changelog

4 versions
  1. Fixing Auto Next Buy

    live

    @biantca·+233 lines·

  2. Add auto next buy

    @biantca·+278 lines·

  3. Lower case for sensitivity

    @biantca·+80 lines·

  4. first version

    @biantca·