Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- = 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 = 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 = 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
- if r then
- return r
- end
- until os.clock()-st >= 5
- --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
- r = true
- end
- if r then
- return 2
- else
- return 0
- end
- end)
- --[[ I can find this out with users api (hasVerifiedBadge)
- afunc(function(plr)
- local verified
- verified = MPS:PlayerOwnsAsset(plr,102611803)
- local t = 0
- if verified then
- t = t + 1
- else
- t = t - 2
- end
- return t
- 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 required groups the player should be in
- {
- id = 3256759, -- vsb
- ranks = {
- ['Owner'] = 30,
- ['Co-Owner'] = 30,
- ['Admin'] = 20,
- ['Group Mod'] = 10,
- ['Sb Mod'] = 10,
- ['Advance Scripter'] = 5,
- ['Scripter'] = 5,
- ['Builder'] = 5,
- },
- },
- {
- id = 16281178, -- lua sandbox
- min_rank = 50,
- ranks = {
- ['Owner'] = 30,
- ['Admin'] = 30,
- ['Developer'] = 20,
- ['Mod'] = 10,
- ['Scripter + Place 1 require permissions'] = 10,
- ['Builder + Place 1 require permissions'] = 10,
- ['Builder'] = 5,
- ['Scripter'] = 5,
- ['Member'] = 1,
- },
- },
- {
- id = 2574296, -- bleu pigs
- ranks = {
- ['Group Holder'] = 30,
- ['Bot'] = 30,
- ['Arbitrator'] = 30,
- ['Elite Pig'] = 10,
- ['Bleu Pig'] = 10,
- ['New Member'] = 5,
- },
- },
- }
- 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 + 5
- end
- end
- end
- return t
- end)
- afunc(function(plr)
- local badges = {
- {
- badge = 1,
- trust = 10
- },
- {
- badge = 7,
- trust = 0.5
- },
- {
- badge = 8,
- trust = 1
- },
- {
- badge = 17,
- trust = 3
- },
- }
- local result = http("https://badges." .. proxy .. "/v1/users/" .. tostring(plr.UserId) .. "/badges")
- if result then else return end
- result = result.data
- local t = 0
- t = t + math.sqrt(point(#result,0,50))/25
- for i,v in pairs(result) do
- for _,b in pairs(badges) do
- if b.badge == v.id then
- t = t + b.trust
- end
- end
- end
- return t
- 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 + 1
- else
- t = t - 1
- end
- if result.user.admin == true then
- t = t + 10
- end
- if result.user.moderator == true then
- t = t + 5
- end
- else
- t = t - 1
- end
- return t
- end)
- afunc(function(plr)
- local result = http("https://friends." .. proxy .. "/v1/users/" .. tostring(plr.UserId) .. "/friends/count")
- if result then
- result = result.count
- 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://friends." .. proxy .. "/v1/users/" .. tostring(plr.UserId) .. "/followers/count")
- if result then
- result = result.count
- result = -0.5 + math.sqrt(point(result,0,100000))/200
- else
- result = -0.5
- end
- return result
- end)
- afunc(function(plr)
- local result = http("https://inventory." .. proxy .. "/v1/users/" .. tostring(plr.UserId) .. "/assets/collectibles?limit=100")
- if result then else return end
- local rap = 0
- for i,v in pairs(result.data) do
- 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 result = http("https://games." .. proxy .. "/v2/users/" .. tostring(plr.UserId) .. "/games")
- if result then else return end
- local visits = 0
- for i,v in pairs(result.data) do
- visits += v.placeVisits
- end
- visits = math.sqrt(visits)/50
- visits = math.clamp(visits,0,200)
- return visits
- 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)
- local result = http("https://users." .. proxy .. "/v1/users/" .. tostring(plr.UserId))
- if result then else return end
- local desc = result.description
- local t = 0
- local blacklist = {
- 'hacked',
- 'pwned',
- 'pawned',
- 'stolen',
- 'breeched',
- 'leaked',
- 'acc taken',
- 'account taken',
- }
- for i,v in pairs(blacklist) do
- if string.match(desc,v) then
- t = t - 50
- end
- end
- if desc == '' then
- t = t - 0.5
- end
- if result.hasVerifiedBadge 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 += 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 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] += 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
- plr:Kick("Low trust factor.(" .. tmin .. " > " .. trust .. ')')
- 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("TextBox")
- 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
- 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 TextBox1 = Instance.new("TextBox")
- local TextBox2 = Instance.new("TextBox")
- 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)
- TextBox1.Name = "name"
- TextBox1.Parent = Frame0
- TextBox1.Position = UDim2.new(0, 0, 0, 0)
- TextBox1.Size = UDim2.new(0.7, 0, 1, 0)
- TextBox1.BackgroundColor = BrickColor.new("Institutional white")
- TextBox1.BackgroundColor3 = Color3.new(1, 1, 1)
- TextBox1.BackgroundTransparency = 1
- TextBox1.BorderSizePixel = 0
- TextBox1.Font = Enum.Font.SourceSans
- TextBox1.FontSize = Enum.FontSize.Size14
- TextBox1.Text = "Roblox"
- TextBox1.TextColor = BrickColor.new("Institutional white")
- TextBox1.TextColor3 = Color3.new(1, 1, 1)
- TextBox1.TextScaled = true
- TextBox1.TextSize = 14
- TextBox1.TextStrokeTransparency = 0
- TextBox1.TextWrap = true
- TextBox1.TextWrapped = true
- TextBox2.Name = "trust"
- TextBox2.Parent = Frame0
- TextBox2.Position = UDim2.new(0.800000012, 0, 0, 0)
- TextBox2.Size = UDim2.new(0.200000003, 0, 1, 0)
- TextBox2.BackgroundColor = BrickColor.new("Institutional white")
- TextBox2.BackgroundColor3 = Color3.new(1, 1, 1)
- TextBox2.BorderSizePixel = 0
- TextBox2.Font = Enum.Font.SourceSans
- TextBox2.FontSize = Enum.FontSize.Size14
- TextBox2.Text = "0"
- TextBox2.TextColor = BrickColor.new("Institutional white")
- TextBox2.TextColor3 = Color3.new(1, 1, 1)
- TextBox2.TextScaled = true
- TextBox2.TextSize = 14
- TextBox2.TextStrokeTransparency = 0
- TextBox2.TextWrap = true
- TextBox2.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
- game:GetService("Players").PlayerAdded:Connect(function(plr)
- connect(plr)
- update()
- end)
- 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
- if list then
- update_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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement