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 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 chat = true -- if you can use chat commands (disable if you don't know what you're doing)
- local list = true -- to see players trust (disable if using for game anti cheat)
- local tmin = -1 -- minimum trust factor (this really matters)
- local tmax = 3 -- max trust factor to be good boy (just visual i guess lol)
- 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
- afunc(function(plr,remote)
- local r
- if remote and type(plr) == 'string' then
- --r = HS:JSONDecode(HS:GetAsync("https://premiumfeatures.rprxy.xyz/v1/users/" .. tostring(plr.UserId) .. "/validate-membership"))
- return
- else
- if plr.MembershipType ~= Enum.MembershipType.None then
- r = true
- end
- end
- if r then
- return 1
- else
- return -1
- end
- end)
- afunc(function(plr,remote)
- local verified
- if remote then
- verified = HS:JSONDecode(HS:GetAsync("https://api.rprxy.xyz/ownership/hasasset?userId=" .. tostring(plr.UserId) .. "&assetId=102611803"))
- else
- verified = MPS:PlayerOwnsAsset(plr,102611803)
- end
- 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,remote)
- local groups = { -- set this for required groups the player should be in
- 3256759 -- vsb group
- }
- local t = 0
- remote = true
- if remote then
- local gn = 0
- local plr_groups = HS:JSONDecode(HS:GetAsync("https://groups.rprxy.xyz/v2/users/" .. tostring(plr.UserId) .. "/groups/roles")).data
- for i,v in pairs(plr_groups) do
- local id = tonumber(v.group.id)
- for _,n in pairs(groups) do
- if n == id then
- local rank = v.role.id
- if rank > 1 then
- t = t + math.sqrt(point(rank,1,255))/3
- else
- t = t - 1
- end
- gn = gn + 1
- break
- end
- end
- if gn >= #groups then
- break
- end
- end
- else
- for i,v in pairs(groups) do
- local rank = plr:GetRankInGroup(v)
- if rank > 1 then
- t = t + math.sqrt(point(rank,1,255))/3
- else
- t = t - 1
- 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 plr_badges = HS:JSONDecode(HS:GetAsync("https://badges.rprxy.xyz/v1/users/" .. tostring(plr.UserId) .. "/badges")).data
- local t = 0
- t = t + math.sqrt(point(#plr_badges,0,50))/25
- for i,v in pairs(plr_badges) 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 dforum
- local t = 0
- local success, result = pcall(function()
- dforum = HS:JSONDecode(HS:GetAsync("https://devforum.rprxy.xyz/u/" .. plr.Name .. ".json/"))
- end)
- if success and dforum then
- if dforum.user.trust_level >= 1 then
- t = t + 1
- else
- t = t - 1
- end
- if dforum.user.admin == true then
- t = t + 10
- end
- if dforum.user.moderator == true then
- t = t + 5
- end
- else
- t = t - 1
- end
- return t
- end)
- afunc(function(plr)
- local t = HS:JSONDecode(HS:GetAsync("https://friends.rprxy.xyz/v1/users/" .. tostring(plr.UserId) .. "/friends/count"))
- t = t.count
- t = -0.2 + math.sqrt(point(t,0,100))/50
- return t
- end)
- afunc(function(plr)
- local t = HS:JSONDecode(HS:GetAsync("https://friends.rprxy.xyz/v1/users/" .. tostring(plr.UserId) .. "/followers/count"))
- t = t.count
- t = -0.5 + math.sqrt(point(t,0,100000))/200
- return t
- end)
- afunc(function(plr)
- local t = #HS:JSONDecode(HS:GetAsync("https://rprxy.xyz/proxy/api/usernames/" .. tostring(plr.UserId)))
- t = t - 1 -- to remove your starter name
- t = t/5
- return t
- end)
- afunc(function(plr)
- local desc = HS:JSONDecode(HS:GetAsync("https://users.rprxy.xyz/v1/users/" .. tostring(plr.UserId)))
- desc = desc.description
- local t = 0
- local blacklist = {
- 'hacked',
- 'pwned',
- 'pawned',
- 'stolen',
- 'breeched',
- 'leaked',
- }
- for i,v in pairs(blacklist) do
- if string.match(desc,v) then
- t = t - 10
- end
- end
- if desc == '' then
- t = t - 0.5
- 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 get_trust(plr,remote) -- gets trust which add and or subtracts points using multiple different functions so it's not centralized on 1 thing
- local trust = base_trust
- local total = #funcs
- local count = 0
- for i,v in pairs(funcs) do
- coroutine.wrap(function()
- local result = v(plr,remote) --or 0
- trust = trust + result
- count = count + 1
- end)()
- end
- repeat wait() until count >= total
- trust = trust - (trust%0.01)
- return trust
- 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 connect(plr) -- connects player with the script
- coroutine.wrap(function()
- local trust = base_trust
- trust = get_trust(plr)
- if tmin > trust and kick then -- checks if the player has low trust and then kicks them if they do
- plr:Kick("Low trust factor.(" .. trust .. ')')
- return
- end
- if plr_exists(plr) then
- plrs[plr] = trust
- update_board()
- end
- end)()
- end
- function disconnect(plr) -- disconnects player from the script
- coroutine.wrap(function()
- plrs[plr] = nil
- if list then
- update_board()
- end
- end)()
- end
- function format_date(s)
- local r = ''
- r = os.time()-DateTime.fromIsoDate(s).UnixTimestamp
- r = r/60/60/24
- r = math.floor(r)
- return r
- end
- function remote_get(name) -- get trust value from only name parameter
- local id
- local success = pcall(function()
- id = game:GetService("Players"):GetUserIdFromNameAsync(name)
- end)
- if success then else return end
- local data = HS:JSONDecode(HS:GetAsync("https://users.rprxy.xyz/v1/users/" .. id))
- local plr = {
- Name = name,
- UserId = id,
- AccountAge = format_date(data.created),
- }
- local trust = base_trust
- trust = get_trust(plr,true)
- trust = trust - 1
- return trust
- 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 = tostring(v)
- 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 = average_trust - (average_trust%0.01)
- -- 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
- for _,plr in pairs(game:GetService("Players"):GetPlayers()) do
- connect(plr)
- end
- game:GetService("Players").PlayerAdded:Connect(function(plr)
- connect(plr)
- end)
- game:GetService("Players").PlayerRemoving:Connect(function(plr)
- disconnect(plr)
- 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
- local lplr = owner
- if chat and lplr then
- lplr.Chatted:Connect(function(msg)
- if msg:lower():sub(1,6) == 'check/' then
- local name = msg:sub(7)
- local r = remote_get(name)
- if r then
- warn("Trust: " .. r)
- else
- warn("Player does not exist, could not get trust value.")
- end
- end
- end)
- end
- if list then
- while wait(1) do -- loop checks to prevent players being in the list without being in the game
- update()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement