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)