Role Exposer
Key Required

Role Exposer

Mafiaasghardilshad0002asghardilshad0002 6.5K views 560 executesUpdated Sep 16, 2025
5.0/ 5(3 votes)
30100% Positive
Lua Script•91 lines (3056 chars)
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local UserInputService = game:GetService("UserInputService")

-- Create ScreenGui
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "RoleDisplayGui"
screenGui.Parent = LocalPlayer:WaitForChild("PlayerGui")

-- Main Frame (draggable container)
local mainFrame = Instance.new("Frame")
mainFrame.Size = UDim2.new(0, 320, 0, 450)
mainFrame.Position = UDim2.new(0.05, 0, 0.2, 0)
mainFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
mainFrame.Active = true
mainFrame.Draggable = true -- makes frame draggable
mainFrame.Parent = screenGui

-- Title bar
local titleBar = Instance.new("TextButton")
titleBar.Size = UDim2.new(1, 0, 0, 30)
titleBar.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
titleBar.Text = "Player Roles (Click to Minimize)"
titleBar.TextColor3 = Color3.fromRGB(255, 255, 255)
titleBar.Font = Enum.Font.SourceSansBold
titleBar.TextSize = 18
titleBar.Parent = mainFrame

-- ScrollingFrame
local scrollingFrame = Instance.new("ScrollingFrame")
scrollingFrame.Size = UDim2.new(1, -10, 1, -40)
scrollingFrame.Position = UDim2.new(0, 5, 0, 35)
scrollingFrame.CanvasSize = UDim2.new(0, 0, 0, 0)
scrollingFrame.ScrollBarThickness = 8
scrollingFrame.BackgroundTransparency = 0.2
scrollingFrame.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
scrollingFrame.Parent = mainFrame

-- Layout
local layout = Instance.new("UIListLayout")
layout.Parent = scrollingFrame
layout.Padding = UDim.new(0, 5)

-- Function to refresh list
local function refreshList()
    for _, child in ipairs(scrollingFrame:GetChildren()) do
        if child:IsA("TextLabel") then
            child:Destroy()
        end
    end
    
    for _, player in ipairs(Players:GetPlayers()) do
        local role = player:GetAttribute("Role") or "No Role"
        local label = Instance.new("TextLabel")
        label.Size = UDim2.new(1, -10, 0, 30)
        label.BackgroundTransparency = 0.3
        label.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
        label.TextColor3 = Color3.fromRGB(255, 255, 255)
        label.Font = Enum.Font.SourceSansBold
        label.TextSize = 18
        label.Text = player.DisplayName .. "'s Role: " .. role
        label.Parent = scrollingFrame
    end
    
    scrollingFrame.CanvasSize = UDim2.new(0, 0, 0, layout.AbsoluteContentSize.Y)
end

-- Update on events
Players.PlayerAdded:Connect(refreshList)
Players.PlayerRemoving:Connect(refreshList)
for _, player in ipairs(Players:GetPlayers()) do
    player:GetAttributeChangedSignal("Role"):Connect(refreshList)
end

-- Initial load
refreshList()

-- Minimize toggle
local minimized = false
titleBar.MouseButton1Click:Connect(function()
    minimized = not minimized
    if minimized then
        scrollingFrame.Visible = false
        mainFrame.Size = UDim2.new(0, 320, 0, 30)
        titleBar.Text = "Player Roles (Click to Expand)"
    else
        scrollingFrame.Visible = true
        mainFrame.Size = UDim2.new(0, 320, 0, 450)
        titleBar.Text = "Player Roles (Click to Minimize)"
    end
end)

Features & Information

tells role of every player in a GUI

Community Comments (11)

Vape_userVape_userSep 17, 2025

Y'all are using AI 💀

Replying to @Vape_user
hacker777hacker777Sep 17, 2025

@Vape_user мне кажется главное чтобы работало разве нет?

Replying to @Vape_user
hacker777hacker777Sep 17, 2025

It seems to me that the main thing is to make it work, isn't it?

Replying to @Vape_user
asghardilshad0002asghardilshad0002Sep 17, 2025

@Vape_user atleast it works gng js enjoy it

mineogomineogoSep 17, 2025

skid mf

Vape_userVape_userSep 17, 2025

Bruh I didn't say it's was bad I just asked him @asghardilshad0002 and what the hell is that name bro

Vape_userVape_userSep 17, 2025

Yeah but imagine you take 20 minutes to do it and someone get more view just by using chatgpt but you take at least 15 minutes to do it but still doesn't have any view or like

Vape_userVape_userSep 17, 2025

It's just unfair at this point

Replying to @Vape_user
hacker777hacker777Sep 17, 2025

@Vape_user 2025 gpt is popular and as for non-gpt, it's just hard to find 2025 gpt is popular and as for non-gpt, it's just hard to find

Replying to @Vape_user
asghardilshad0002asghardilshad0002Sep 18, 2025

@Vape_user its for everyone

Replying to @asghardilshad0002
Vape_userVape_userSep 18, 2025

@asghardilshad0002 I didn't say it's was for someone particularly...

More Scripts for Mafia