Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- = TRUST CALC =
- Made by KrYn0MoRe
- ]]
- 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
- 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 = 100
- 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)
- 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)
- 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
- 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
- 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 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 Calc"
- 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.Name
- 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,trust in pairs(plrs) do
- if plr_exists(plr) and trust then
- total_plrs = total_plrs + 1
- total_trust = total_trust + trust
- 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.Name = trust
- 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(trust)
- name_t.Text = plr.Name
- 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
- --
- 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 Calc (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
- if list then
- update_board()
- end
- break
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement