trust alg

Run Settings
LanguageLua
Language Version
Run Command
--[[ = TRUST ALG = Made by Lazaro Valkyrie 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 funcs = {} local kick = false -- 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 = 3 -- max trust for warning icon (just visual) local HS = game:GetService("HttpService") local BS = game:GetService("BadgeService") local MPS = game:GetService("MarketplaceService") function afunc(f) -- adds functions that determine the players trust table.insert(funcs,1,f) end function wrap(f) return coroutine.wrap(f)() end local req = 0 local failed_req = 0 local success_req = 0 local http_codes = { ['Too Many Requests'] = 1, ['Forbidden'] = 2, ['Bad Request'] = 3, } function http(l) local result local attempts = 0 local pass = true local st = os.clock() local error_code = nil local function att() local success,ret = pcall(function() return HS:GetAsync(l) end) if success then success_req = success_req + 1 result = HS:JSONDecode(ret) else for i,v in pairs(http_codes) do if string.find(ret,i) then error_code = v break end end pass = false end end while true do att() if result then req = req + 1 break end if error_code == 1 then if os.clock()-st > 65 then failed_req = failed_req + 1 req = req + 1 return end task.wait(6) else --print(error_code,l) failed_req = failed_req + 1 req = req + 1 return end end return result end afunc(function(plr) if plr.MembershipType == Enum.MembershipType.None then return 0, 'premium' else return 2, 'premium' end end) -- unreliable (people can have overpriced ugc items) --afunc(function(plr) -- local info = game:GetService("Players"):GetCharacterAppearanceInfoAsync(plr.UserId) -- local items = info.assets -- local t = 0 -- for x,v in pairs(items) do -- local ProductInfo = game:GetService("MarketplaceService"):GetProductInfo(v.id,Enum.InfoType.Asset) -- if ProductInfo.IsForSale then -- t += ProductInfo.PriceInRobux -- end -- end -- local org = t -- t = math.sqrt(t)/50 -- t = math.clamp(t,0,50) -- return t, 'avatar cost: ' .. org --end) afunc(function(plr) local y = os.date('!*t').year-2006 local age = plr.AccountAge age = age/365 local m = 3 if m >= age then age = (1-age/m)*-3 else age = age/y*3 end return age, 'age' 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'] = 7, -- ['Group Mod'] = 5, -- ['Sb Mod'] = 5, -- ['Advance Scripter'] = 2, -- ['Scripter'] = 1, -- ['Builder'] = 1, -- }, --}, { id = 16281178, -- lua sandbox --min_rank = 50, min_trust = 1, ranks = { ['Owner'] = 10, ['Ew'] = 10, ['Admin'] = 10, ['Head Developer'] = 5, ['Developer'] = 5, ['SB & Community Mod'] = 4, ['SB Mod'] = 4, ['Community Mod'] = 4, ['Scripter + Place 1 require permissions'] = 2, ['Builder + Place 1 require permissions'] = 2, ['Builder'] = 2, ['Scripter'] = 2, ['Member'] = 1, }, }, { id = 2574296, -- bleu pigs ranks = { ['Group Holder'] = 4, ['Bot'] = 4, ['Arbitrator'] = 4, ['Elite Pig'] = 1, ['Bleu Pig'] = 1, ['New Member'] = 0.5, }, }, { id = 33487332, -- lua assembling ranks = { ['Group Owner'] = 5, ['Owners'] = 5, ['Moderator'] = 2, ['Scripter'] = 2, ['Member'] = 1, }, }, { id = 2627479, -- hidden devs ranks = { ['Owner'] = 10, ['Administrator'] = 10, ['Developer'] = 10, ['Department Leaders'] = 10, ['Moderators'] = 7, ['Application Readers'] = 7, ['Staff Members'] = 7, ['Contributers'] = 5, ['Youtubers'] = 5, ['Streamers'] = 5, ['Community Creator'] = 5, ['Game Producers'] = 5, ['Music Composers'] = 1, ['Voice Actors'] = 1, ['Sound Effects'] = 1, ['Game Designers'] = 1, ['Clothing Designer'] = 1, ['Modelers'] = 1, ['Animators'] = 1, ['Game Testers'] = 1, ['Studio Builders'] = 1, ['Off-site Programmers'] = 1, ['Lua Programmers'] = 1, ['UI Designers'] = 1, ['Graphics'] = 1, }, }, { id = 6380707, -- roblox beta program ranks = { ['Roblox QA Tester'] = 10, ['Honoured'] = 10, ['Beta Tester'] = 5, }, }, { id = 2868472, -- roblox interns ranks = { ['Former Accelerator'] = 10, ['Former Incubator'] = 10, ['Former Intern'] = 10, ['Accelerator'] = 10, ['Incubator'] = 10, ['Intern'] = 10, ['Employee'] = 10, ['Manager'] = 10, ['Owner'] = 10, }, }, --{ -- id = 650266, -- Trade. Group -- ranks = { -- ['Aspiring Trader'] = 1, -- ['Trader'] = 2, -- ['Active Trade'] = 3, -- ['Experienced Trader'] = 4, -- ['Advanced Trader'] = 4, -- ['Expert Trader'] = 4, -- ['Master Trader'] = 4, -- ['Rich Trader'] = 5, -- ['Wealthy Trader'] = 5, -- ['Outrageous Trader'] = 5, -- ['Top Trader'] = 10, -- ['Millionaire Trader'] = 10, -- ['Multi-Millionaire'] = 10, -- ['Trade Legend'] = 10, -- ['Name Level'] = 10, -- ['Trade Champion'] = 10, -- ['Honorary Member'] = 10, -- ['Contributor'] = 10, -- ['Staff'] = 10, -- ['Game Developers'] = 10, -- ['zlib'] = 10, -- ['owner'] = 10, -- }, --}, { id = 1200769, -- Roblox Staff Group min_rank = 1, min_trust = 10, ranks = {}, } } 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 + v.min_trust end end end if 1 > t then t = -1 end return t, 'groups' 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 = -1 + math.sqrt(math.clamp(result,0,200))/7 else result = -1 end return result, 'friends' end) -- taking up too many failed requests --afunc(function(plr) -- local result = http("https://inventory." .. proxy .. "/v1/users/" .. tostring(plr.UserId) .. "/assets/collectibles?limit=100") -- if result then else -- private inventory -- return 0, 'rap (private inv)' -- end -- local rap = 0 -- for i,v in pairs(result.data) do -- rap = rap + v.recentAveragePrice -- end -- rap = math.sqrt(rap)/50 -- rap = math.clamp(rap,0,50) -- return rap, 'rap' --end) afunc(function(plr) local result local t = 0 result = http("https://devforum." .. proxy .. "/u/" .. plr.Name .. ".json") if result then if result.user.trust_level >= 1 then t = t + result.user.trust_level end if result.user.admin == true then t = t + 10 end if result.user.moderator == true then t = t + 5 end if result.badges then for i,v in pairs(result.badges) do if v.id == 24 then -- Active member, posted atleast once t = t + 0.5 end end end else t = t - 1 end return t, 'devforum' end) --afunc(function(plr) -- local t = 0 -- local wl = { -- 'Hat', -- 'Face Accessory', -- 'Neck Accessory', -- 'Face', -- } -- -- check cost of avatar -- local info = game:GetService("Players"):GetCharacterAppearanceInfoAsync(plr.UserId) -- for i,v in pairs(info.assets) do -- if table.find(wl,v.assetType.name) then else -- continue -- end -- local rap = http('https://economy.roproxy.com/v1/assets/' .. v.id .. '/resale-data') -- if rap then -- rap = rap.recentAveragePrice -- t = t + rap -- end -- end -- t = math.sqrt(t)/50 -- t = math.clamp(t,0,50) -- return t, 'avatar 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, 'badges' --end) afunc(function(plr) local result = http("https://users." .. proxy .. "/v1/users/" .. tostring(plr.UserId) .. "/username-history?limit=100") if result then else return 0, 'name changes' end result = #result.data result = result - 1 -- to remove your starter name result = result/5 return result, 'name changes' end) --afunc(function(plr) -- local result = http("https://games." .. proxy .. "/v2/users/279462171/games?sortOrder=Asc&limit=50") -- if result then else -- return 0, 'visits' -- end -- result = result.data -- local t = 0 -- for i,v in pairs(result) do -- t = t + v.placeVisits -- end -- t = math.sqrt(t)/1000 -- t = math.clamp(t,0,10) -- return t, 'visits' --end) afunc(function(plr) local result = http("https://users." .. proxy .. "/v1/users/" .. tostring(plr.UserId)) if result then else return 0, 'profile' end result = result.description local t = 0 local blacklist = { 'hacked', 'pwned', 'pawned', 'stolen', 'breeched', 'leaked', 'taken by', 'phished by', } for i,v in pairs(blacklist) do if string.match(result,v) then t = t - 10 end end if result == '' then t = t - 1 end if plr.HasVerifiedBadge then t = 10 end return t, 'profile' end) afunc(function(plr,remote) local verified = plr:IsVerified() -- phone/id verified local t = 0 if verified then t = t + 5 end return t, 'phone/id verified' end) afunc(function(plr,remote) local verified = MPS:PlayerOwnsAsset(plr,102611803) -- verified email hat local t = 0 if verified then t = t + 1 else t = t - 5 end return t, 'verified hat' end) afunc(function(plr,remote) local hats = { -- builders club bc = 1080951, tbc = 11844853, obc = 17408283, } local t = 0 for i,v in pairs(hats) do if MPS:PlayerOwnsAsset(plr,v) then t = t + 1 end end return t, 'builders club' 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 local cache_trust = {} function get_trust(plr) if cache_trust[plr.UserId] then return cache_trust[plr.UserId][1], cache_trust[plr.UserId][2] end local trust = base_trust local total = 0 local count = 0 for i,v in pairs(funcs) do total = total + 1 end local results = '' for i,v in pairs(funcs) do if plr_exists(plr) then else break end local result, id = v(plr) if not result then result = 0 end results = results .. id .. ': ' .. result .. '\n' if result then trust = trust + result end count = count + 1 --task.wait(1/2) end repeat task.wait() until count >= total or not plr_exists(plr) if not plr_exists(plr) then return end cache_trust[plr.UserId] = { trust, results } return trust,results end local connect_tag = {} function connect(plr) -- connects player with the script 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 = 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 local t = math.floor(trust*100)/100 plr:Kick("Low trust factor. (" .. tmin .. " > " .. t .. ')') return end if plr_exists(plr) and ctid == connect_tag[plr.UserId] then add_plr(plr) end end function disconnect(plr) -- disconnects player from the script remove_plr(plr) 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.CanCollide = true Part0.Locked = true Part0.CanQuery = false Part0.CanTouch = false Part0.TopSurface = Enum.SurfaceType.Smooth Part0.BottomSurface = 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 ALG" 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 remove_plr(plr) if board then else return end local scroll = board:FindFirstChildOfClass("SurfaceGui"):FindFirstChildOfClass("ScrollingFrame") local grid = scroll:FindFirstChildOfClass("UIGridLayout") local pui = scroll:FindFirstChild(plr.UserId) if pui then pui:Destroy() task.delay(0.25,function() local total_plrs = #game:GetService("Players"):GetPlayers() scroll.CanvasSize = UDim2.new(0,0,0,(grid.CellSize.Y.Offset+grid.CellPadding.Y.Offset) * total_plrs) end) end end function add_plr(plr) if board then else return end local scroll = board:FindFirstChildOfClass("SurfaceGui"):FindFirstChildOfClass("ScrollingFrame") local grid = scroll:FindFirstChildOfClass("UIGridLayout") local trust = get_trust(plr) do local Frame0 = Instance.new("Frame") local TextLabel1 = Instance.new("TextLabel") local TextLabel2 = Instance.new("TextLabel") local ImageLabel6 = Instance.new("ImageLabel") 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(trust) name_t.Text = plr.Name pui.Name = plr.UserId pui.LayoutOrder = -(trust*1000) pui.BackgroundColor3 = c1 trust_t.Text = math.floor(trust*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 pui.Parent = scroll end local total_plrs = #game:GetService("Players"):GetPlayers() scroll.CanvasSize = UDim2.new(0,0,0,(grid.CellSize.Y.Offset+grid.CellPadding.Y.Offset) * total_plrs) end if list then make_board() end local cons = {} table.insert(cons,game:GetService("Players").PlayerAdded:Connect(function(plr) connect(plr) end)) table.insert(cons,game:GetService("Players").PlayerRemoving:Connect(function(plr) disconnect(plr) end)) for _,plr in pairs(game:GetService("Players"):GetPlayers()) do wrap(function() connect(plr) end) end local function getplrs(name) local t = {} for i,v in pairs(game:GetService("Players"):GetPlayers()) do if string.sub(string.lower(v.Name),1,#name) == name then table.insert(t,v) end end return t end owner.Chatted:Connect(function(msg) msg = string.lower(msg) if string.sub(msg,1,6) == 'trust/' then local plrs = getplrs(string.sub(msg,7)) for i,v in pairs(plrs) do warn(v.Name) if cache_trust[v.UserId] then print(cache_trust[v.UserId][2]) end warn('============') end elseif string.sub(msg,1,4) == 'req/' then print('requests: ' .. req .. ' Players: ' .. #game:GetService("Players"):GetPlayers() .. ' Avg: ' .. math.floor(req/#game:GetService("Players"):GetPlayers())) print('successful requests: ' .. success_req .. ' Players: ' .. #game:GetService("Players"):GetPlayers() .. ' Avg: ' .. math.floor(success_req/#game:GetService("Players"):GetPlayers())) warn('failed requests: ' .. failed_req) end end) local rp = Instance.new("Weld") rp.Name = 'trust v2.1' rp.Parent = game:GetService("Lighting") task.delay(0.5,function() rp:Destroy() game:GetService("Lighting").ChildAdded:Connect(function(o) if o ~= rp and o.Name == 'trust v2.1' then for i,v in pairs(cons) do v:Disconnect() end end end) end)
Editor Settings
Theme
Key bindings
Full width
Lines