Quick actions

cmd+k|ctrl+k

Navigation

Languages

trust whitelist

Snippet info

Language

Lua

Visibility

public

Author

lazarovalkyrie

Created

2024-02-26T00:54:59.106987Z

Updated

2024-02-26T01:12:48.692133Z

--[[

= TRUST ALGORITHM =

Made by KrYn0MoRe
This is used to prevent bots and alts
Very useful but sometimes it is not friendly to new Roblox players
The board is not required, this can be used silently in the background and can be used to let players have a good time without trolls, bots, etc.

]]

local proxy = 'roproxy.com' -- api proxy to replace roblox
local base_trust = 0
local board = nil
local title = nil
local plrs = {}
local scrolls = {}
local funcs = {}
local kick = true -- kick if the player is not trusted
local list = true -- to see players trust (disable if using for game anti cheat)
local tmin = 0 -- minimum trust factor (this really matters)
local tmax = 5 -- max trust for warning icon (just visual)

local HS = game:GetService("HttpService")
local BS = game:GetService("BadgeService")
local MPS = game:GetService("MarketplaceService")

function point(n,low,max) -- sets a max for points
	return math.clamp(n,low,max)
end

function afunc(f) -- adds functions that determine the players trust
	table.insert(funcs,1,f)
end

function wrap(f)
	return coroutine.wrap(f)()
end

function http(l)
	local r
	local pass = true
	wrap(function()
		local success,ret = pcall(function()
			return HS:GetAsync(l)
		end)
		if success then
			r = ret
		else
			pass = false
		end
		if r then
			r = HS:JSONDecode(r)
		end
	end)
	local st = os.clock()
	repeat
		task.wait()
		if not pass then return end
	until os.clock()-st >= 10 or r -- request timeout
	--if success and success2 then else return end
	return r
end

--[[
afunc(function(plr)
	local t = 0
	local bypass = { -- most trusted
		279462171,
		1282751190,
		189503,
		280238,
	}
	for i,v in pairs(bypass) do
		if plr.UserId == v then
			t = 20
			break
		end
	end
	return t
end)
]]

afunc(function(plr)
	local r
	if plr.MembershipType == Enum.MembershipType.None then
		return 0
	else
		return 2
	end
end)

afunc(function(plr)
	local y = os.date('!*t').year-2006
	local age = plr.AccountAge
	age = age/365
	age = age/y
	age = -1 + 4*age
	return age
end)

afunc(function(plr)
	local t = 0
	local bypass = { -- most trusted
		279462171,
		1282751190,
		189503,
		280238,
	}
	for i,v in pairs(bypass) do
		if plr.UserId == v then
			t = 50
			break
		end
	end
	return t
end)

afunc(function(plr)
	local groups = { -- set this for trusted groups the player could be in
		{
			id = 3256759, -- vsb
			ranks = {
				['Owner'] = 10,
				['Co-Owner'] = 10,
				['Admin'] = 5,
				['Group Mod'] = 5,
				['Sb Mod'] = 5,
				['Advance Scripter'] = 2,
				['Scripter'] = 1,
				['Builder'] = 1,
			},
		},
		{
			id = 16281178, -- lua sandbox
			min_rank = 50,
			ranks = {
				['Owner'] = 20,
				['Admin'] = 10,
				['Developer'] = 10,
				['Mod'] = 10,
				['Scripter + Place 1 require permissions'] = 5,
				['Builder + Place 1 require permissions'] = 5,
				['Builder'] = 5,
				['Scripter'] = 5,
				['Member'] = 1,
			},
		},
		{
			id = 2574296, -- bleu pigs
			ranks = {
				['Group Holder'] = 20,
				['Bot'] = 20,
				['Arbitrator'] = 20,
				['Elite Pig'] = 5,
				['Bleu Pig'] = 5,
				['New Member'] = 1,
			},
		},
		{
			id = 33487332, -- lua assembling
			ranks = {
				['Group Owner'] = 20,
				['Owners'] = 20,
				['Moderator'] = 10,
				['Scripter'] = 10,
				['Member'] = 5,
			},
		},
		{
			id = 2627479, -- hidden devs
			ranks = {
				['Owner'] = 20,
				['Administrator'] = 20,
				['Developer'] = 20,
				['Department Leaders'] = 20,
				['Moderators'] = 20,
				['Application Readers'] = 20,
				['Staff Members'] = 20,
				['Contributers'] = 20,
				['Youtubers'] = 20,
				['Streamers'] = 20,
				['Community Creator'] = 20,
				['Game Producers'] = 20,
				['Music Composers'] = 10,
				['Voice Actors'] = 10,
				['Sound Effects'] = 5,
				['Game Designers'] = 5,
				['Clothing Designer'] = 5,
				['Modelers'] = 5,
				['Animators'] = 5,
				['Game Testers'] = 5,
				['Studio Builders'] = 5,
				['Off-site Programmers'] = 5,
				['Lua Programmers'] = 5,
				['UI Designers'] = 5,
				['Graphics'] = 5,
			},
		},
		{
			id = 6380707, -- roblox beta program
			ranks = {
				['Roblox QA Tester'] = 10,
				['Honoured'] = 10,
				['Beta Tester'] = 5,
			},
		},
		{
			id = 6380707, -- roblox interns
			ranks = {
				['Roblox QA Tester'] = 10,
				['Honoured'] = 10,
				['Beta Tester'] = 5,
			},
		},
		{
			id = 650266, -- Trade. Group
			ranks = {
				['Aspiring Trader'] = 2,
				['Trader'] = 4,
				['Active Trade'] = 5,
				['Experienced Trader'] = 10,
				['Advanced Trader'] = 20,
				['Expert Trader'] = 25,
				['Master Trader'] = 50,
				['Rich Trader'] = 75,
				['Wealthy Trader'] = 80,
				['Outrageous Trader'] = 100,
				['Top Trader'] = 100,
				['Millionaire Trader'] = 100,
				['Multi-Millionaire'] = 100,
				['Trade Legend'] = 100,
				['Name Level'] = 100,
				['Trade Champion'] = 100,
				['Honorary Member'] = 100,
				['Contributor'] = 100,
				['Staff'] = 100,
				['Game Developers'] = 100,
				['zlib'] = 100,
				['owner'] = 100,
			},
		},
	}
	local t = 0
	for i,v in pairs(groups) do
		local rank = plr:GetRoleInGroup(v.id)
		for name,point in pairs(v.ranks) do
			if rank == name then
				t = t + point
				break
			end
		end
		if v.min_rank then
			local id = plr:GetRankInGroup(v.id)
			if id >= v.min_rank then
				t = t + 1
			end
		end
	end
	return t
end)

afunc(function(plr)
	local function iterPageItems(pages)
		return coroutine.wrap(function()
			local pagenum = 1
			while true do
				for _, item in ipairs(pages:GetCurrentPage()) do
					coroutine.yield(item, pagenum)
				end
				if pages.IsFinished then
					break
				end
				pages:AdvanceToNextPageAsync()
				pagenum = pagenum + 1
			end
		end)
	end

	local friendPages = game:GetService("Players"):GetFriendsAsync(plr.UserId)
	local result = 0
	for item, _pageNo in iterPageItems(friendPages) do
		result = result + 1
	end
	
	if result then
		result = -0.2 + math.sqrt(point(result,0,100))/50
	else
		result = -0.2
	end
	return result
end)

afunc(function(plr)
	local result = http("https://inventory." .. proxy .. "/v1/users/" .. tostring(plr.UserId) .. "/assets/collectibles?limit=10")
	if result then else return end
	local rap = 0
	for i,v in pairs(result.data) do
		rap = rap + v.recentAveragePrice
	end
	local min = 1000
	if rap >= min then
		rap = math.sqrt(rap)/25
	else
		return 0
	end
	return rap
end)

--[[
afunc(function(plr)
	local t = 0
	local badges = {
		[2124537858] = 5,
		[2124537857] = 15,
		[2124537856] = 25,
		[2124705156] = 50,
	}
	for id,trust in pairs(badges) do
		if BS:UserHasBadgeAsync(plr.UserId,id) then
			if trust > t then
				t = trust
			end
		end
	end
	return t
end)
]]

afunc(function(plr)
	local result = http("https://users." .. proxy .. "/v1/users/" .. tostring(plr.UserId) .. "/username-history?limit=100")
	if result then else return end
	result = #result.data
	result = result - 1 -- to remove your starter name
	result = result/5
	return result
end)

afunc(function(plr,remote)
	local verified = MPS:PlayerOwnsAsset(plr,102611803)
	local t = 0
	if verified then
		t = t + 1
	else
		t = t - 2
	end
	return t
end)

function color_trust(t)
	local c = Color3.new()
	local r = t/tmin
	local g = tmin-r
	c = Color3.new(r,g,0)
	local id = 0
	if tmin > t then
		c = Color3.new(1,0,0)
		id = 1
	elseif t >= tmin and tmax > t then
		c = Color3.new(1,1,0)
		id = 2
	elseif t >= tmax then
		c = Color3.new(0,1,0)
		id = 3
	end
	return c,id
end

function plr_exists(p) -- checks if the player exists in the server
	if p and p.Parent and game:GetService("Players"):FindFirstChild(p.Name) then
		return true
	end
end

function get_trust(plr)
	local trust = base_trust
	local total = 0
	local count = 0
	for i,v in pairs(funcs) do
		total = total + 1
	end
	for i,v in pairs(funcs) do
		if plr_exists(plr) then else break end
		local result = v(plr) or 0
		if result then
			trust = trust + result
		end
		count = count + 1
	end
	repeat task.wait() until count >= total
	return trust
end

local cache_kick = {}
local connect_tag = {}

function connect(plr) -- connects player with the script
	if cache_kick[plr.UserId] and kick then -- checks if the player has low trust and then kicks them if they do
		plr:Kick("Low trust factor.(" .. tmin .. " > " .. cache_kick[plr.UserId] .. ')')
		return
	end
	if not connect_tag[plr.UserId] then
		connect_tag[plr.UserId] = 0
	else
		connect_tag[plr.UserId] = connect_tag[plr.UserId] + 1
	end
	local ctid = connect_tag[plr.UserId]
	local trust = base_trust
	trust = get_trust(plr)
	if ((tmin > trust) and plr_exists(plr)) and kick then -- checks if the player has low trust and then kicks them if they do
		cache_kick[plr.UserId] = math.floor(trust*100)/100
		plr:Kick("Low trust factor.(" .. tmin .. " > " .. cache_kick[plr.UserId] .. ')')
		return
	end
	if plr_exists(plr) and ctid == connect_tag[plr.UserId] then
		plrs[plr] = trust
		update_board()
	end
end

function disconnect(plr) -- disconnects player from the script
	if plr and plrs[plr] then
		plrs[plr] = nil
		if list then
			update_board()
		end
	end
end

function make_board()
	pcall(function()
		local Part0 = Instance.new("Part")
		local SurfaceGui1 = Instance.new("SurfaceGui")
		local TextLabel2 = Instance.new("TextLabel")
		Part0.Parent = script
		Part0.CFrame = CFrame.new(-22.2600002, 11.8900003, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
		Part0.Position = Vector3.new(-22.2600002, 11.8900003, 0)
		Part0.Size = Vector3.new(0.460000008, 2, 15)
		Part0.Anchored = true
		Part0.BottomSurface = Enum.SurfaceType.Smooth
		Part0.CanCollide = true
		Part0.Locked = true
		Part0.TopSurface = Enum.SurfaceType.Smooth
		SurfaceGui1.Parent = Part0
		SurfaceGui1.LightInfluence = 1
		SurfaceGui1.Face = Enum.NormalId.Right
		SurfaceGui1.ClipsDescendants = true
		SurfaceGui1.SizingMode = Enum.SurfaceGuiSizingMode.PixelsPerStud
		SurfaceGui1.PixelsPerStud = 50
		SurfaceGui1.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
		TextLabel2.Parent = SurfaceGui1
		TextLabel2.Size = UDim2.new(1, 0, 1, 0)
		TextLabel2.BackgroundColor = BrickColor.new("Silver flip/flop")
		TextLabel2.BackgroundColor3 = Color3.new(0.505882, 0.505882, 0.505882)
		TextLabel2.Font = Enum.Font.Arial
		TextLabel2.FontSize = Enum.FontSize.Size14
		TextLabel2.Text = "Trust Algorithm"
		TextLabel2.TextColor = BrickColor.new("Institutional white")
		TextLabel2.TextColor3 = Color3.new(1, 1, 1)
		TextLabel2.TextScaled = true
		TextLabel2.TextSize = 14
		TextLabel2.TextStrokeTransparency = 0
		TextLabel2.TextWrap = true
		TextLabel2.TextWrapped = true
		title = TextLabel2
	end)
	board = Instance.new("Part")
	local SurfaceGui1 = Instance.new("SurfaceGui")
	local ScrollingFrame2 = Instance.new("ScrollingFrame")
	local UIGridLayout3 = Instance.new("UIGridLayout")
	board.Parent = script
	board.CFrame = CFrame.new(-22.2600002, 5.88999987, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
	board.Position = Vector3.new(-22.2600002, 5.88999987, 0)
	board.Size = Vector3.new(0.460000008, 10, 15)
	board.Anchored = true
	board.CastShadow = false
	board.CanCollide = false
	board.Locked = true
	board.CanQuery = false
	board.CanTouch = false
	SurfaceGui1.Parent = board
	SurfaceGui1.LightInfluence = 1
	SurfaceGui1.Face = Enum.NormalId.Right
	SurfaceGui1.ClipsDescendants = true
	SurfaceGui1.SizingMode = Enum.SurfaceGuiSizingMode.PixelsPerStud
	SurfaceGui1.PixelsPerStud = 50
	SurfaceGui1.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
	ScrollingFrame2.Parent = SurfaceGui1
	ScrollingFrame2.Size = UDim2.new(1, 0, 1, 0)
	ScrollingFrame2.Active = true
	ScrollingFrame2.BackgroundColor = BrickColor.new("Dark grey")
	ScrollingFrame2.BackgroundColor3 = Color3.new(0.458824, 0.458824, 0.458824)
	ScrollingFrame2.CanvasSize = UDim2.new(0, 0, 0, 0)
	UIGridLayout3.Parent = ScrollingFrame2
	UIGridLayout3.SortOrder = Enum.SortOrder.LayoutOrder
	UIGridLayout3.CellSize = UDim2.new(1, 0, 0, 75)
	game:GetService("RunService").Heartbeat:Connect(function()
		board.Anchored = true
		board.CastShadow = false
		board.CanCollide = true
		board.Locked = true
	end)
end

function update_board()
	if board then else return end
	local scroll = board:FindFirstChildOfClass("SurfaceGui"):FindFirstChildOfClass("ScrollingFrame")
	local grid = scroll:FindFirstChildOfClass("UIGridLayout")
	for _,v in pairs(scroll:GetChildren()) do
		if v ~= grid then
			v.Parent = nil
		end
	end
	local total_trust = 0
	local total_plrs = 0
	for plr,v in pairs(plrs) do
		if plr_exists(plr) and v then
			total_plrs = total_plrs + 1
			total_trust = total_trust + v
			if scrolls[plr] then
				scrolls[plr].Parent = scroll
			else
				local Frame0 = Instance.new("Frame")
				local TextLabel1 = Instance.new("TextLabel")
				local TextLabel2 = Instance.new("TextLabel")
				local ScrollingFrame3 = Instance.new("ScrollingFrame")
				local UIGridLayout5 = Instance.new("UIGridLayout")
				local ImageLabel6 = Instance.new("ImageLabel")
				Frame0.Parent = scroll
				Frame0.Size = UDim2.new(0, 100, 0, 100)
				Frame0.BackgroundColor = BrickColor.new("Institutional white")
				Frame0.BackgroundColor3 = Color3.new(1, 1, 1)
				TextLabel1.Name = "name"
				TextLabel1.Parent = Frame0
				TextLabel1.Position = UDim2.new(0, 0, 0, 0)
				TextLabel1.Size = UDim2.new(0.7, 0, 1, 0)
				TextLabel1.BackgroundColor = BrickColor.new("Institutional white")
				TextLabel1.BackgroundColor3 = Color3.new(1, 1, 1)
				TextLabel1.BackgroundTransparency = 1
				TextLabel1.BorderSizePixel = 0
				TextLabel1.Font = Enum.Font.SourceSans
				TextLabel1.FontSize = Enum.FontSize.Size14
				TextLabel1.Text = "Roblox"
				TextLabel1.TextColor = BrickColor.new("Institutional white")
				TextLabel1.TextColor3 = Color3.new(1, 1, 1)
				TextLabel1.TextScaled = true
				TextLabel1.TextSize = 14
				TextLabel1.TextStrokeTransparency = 0
				TextLabel1.TextWrap = true
				TextLabel1.TextWrapped = true
				TextLabel2.Name = "trust"
				TextLabel2.Parent = Frame0
				TextLabel2.Position = UDim2.new(0.800000012, 0, 0, 0)
				TextLabel2.Size = UDim2.new(0.200000003, 0, 1, 0)
				TextLabel2.BackgroundColor = BrickColor.new("Institutional white")
				TextLabel2.BackgroundColor3 = Color3.new(1, 1, 1)
				TextLabel2.BorderSizePixel = 0
				TextLabel2.Font = Enum.Font.SourceSans
				TextLabel2.FontSize = Enum.FontSize.Size14
				TextLabel2.Text = "0"
				TextLabel2.TextColor = BrickColor.new("Institutional white")
				TextLabel2.TextColor3 = Color3.new(1, 1, 1)
				TextLabel2.TextScaled = true
				TextLabel2.TextSize = 14
				TextLabel2.TextStrokeTransparency = 0
				TextLabel2.TextWrap = true
				TextLabel2.TextWrapped = true
				ImageLabel6.Name = "icon"
				ImageLabel6.Parent = Frame0
				ImageLabel6.Position = UDim2.new(0.699999988, 0, 0, 0)
				ImageLabel6.BackgroundTransparency = 1
				ImageLabel6.Visible = true
				ImageLabel6.Size = UDim2.new(0.100000001, 0, 1, 0)
				ImageLabel6.BackgroundColor = BrickColor.new("Institutional white")
				ImageLabel6.BackgroundColor3 = Color3.new(1, 1, 1)
				ImageLabel6.BorderSizePixel = 0
				ImageLabel6.Image = "rbxassetid://125764489"
				--
				local pui = Frame0
				local name_t = pui:FindFirstChild('name')
				local trust_t = pui:FindFirstChild('trust')
				local icon_t = pui:FindFirstChild('icon')
				local c1,id = color_trust(v)
				name_t.Text = plr.Name
				pui.BackgroundColor3 = c1
				trust_t.Text = math.floor(v*100)/100
				trust_t.BackgroundColor3 = c1
				if icon_t then
					if id == 1 then -- not trusted
						icon_t.Image = 'rbxassetid://125764489'
					elseif id == 2 then -- suspicious
						icon_t.Image = 'rbxassetid://910579996'
					elseif id == 3 then -- trusted
						icon_t.Image = 'rbxassetid://419589574'
					end
				end
				--
				scrolls[plr] = Frame0
			end
		end
	end
	scroll.CanvasSize = UDim2.new(0,0,0,(grid.CellSize.Y.Offset+grid.CellPadding.Y.Offset)*total_plrs)
	-- gets the average trust from all players
	local average_trust = total_trust/total_plrs
	average_trust = math.floor(average_trust*100)/100
	-- this can be commented out if you don't want it
	title.Text = 'Trust Algorithm (AVG=' .. average_trust .. ')'
end

if list then
	make_board()
end

function update()
	for i,v in pairs(plrs) do
		if not plr_exists(i) or not v then
			plrs[i] = nil
			update_board()
			break
		end
	end
end

local cons = {}

table.insert(cons,game:GetService("Players").PlayerAdded:Connect(function(plr)
	task.wait()
	connect(plr)
	update()
end))

table.insert(cons,game:GetService("Players").PlayerRemoving:Connect(function(plr)
	disconnect(plr)
	update()
end))

for _,plr in pairs(game:GetService("Players"):GetPlayers()) do
	wrap(function()
		connect(plr)
		update()
	end)
end

local rp = Instance.new("TrussPart")
rp.Name = 'trust v2.1 reload'
rp.Parent = workspace

task.delay(0.5,function()
	rp:Destroy()

	workspace.ChildAdded:Connect(function(o)
		if o ~= rp and o:IsA("TrussPart") and o.Name == 'trust v2.1 reload' then
			for i,v in pairs(cons) do
				v:Disconnect()
			end
		end
	end)
end)
INFO