Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- LocalScript (StarterPlayerScripts OR executor loadstring)
- local Players = game:GetService("Players")
- local Teams = game:GetService("Teams")
- local StarterGui = game:GetService("StarterGui")
- local player = Players.LocalPlayer
- -- TRACKING TABLE
- local trackedRoles = {}
- -- GUI CREATION
- local screenGui = Instance.new("ScreenGui")
- screenGui.Name = "RoleNotifier"
- screenGui.Parent = player:WaitForChild("PlayerGui")
- local frame = Instance.new("Frame")
- frame.Size = UDim2.new(0, 260, 0, 320)
- frame.Position = UDim2.new(0, 50, 0, 200)
- frame.BackgroundColor3 = Color3.fromRGB(35, 35, 35)
- frame.Active = true
- frame.Draggable = true -- allows moving
- frame.Parent = screenGui
- local title = Instance.new("TextLabel")
- title.Text = "Role Notifications"
- title.Size = UDim2.new(1, 0, 0, 30)
- title.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
- title.TextColor3 = Color3.new(1, 1, 1)
- title.Font = Enum.Font.SourceSansBold
- title.TextSize = 18
- title.Parent = frame
- -- Minimize Button
- local minimizeButton = Instance.new("TextButton")
- minimizeButton.Text = "-"
- minimizeButton.Size = UDim2.new(0, 30, 0, 30)
- minimizeButton.Position = UDim2.new(1, -30, 0, 0)
- minimizeButton.BackgroundColor3 = Color3.fromRGB(80, 80, 80)
- minimizeButton.TextColor3 = Color3.new(1, 1, 1)
- minimizeButton.Parent = frame
- local contentFrame = Instance.new("Frame")
- contentFrame.Size = UDim2.new(1, -10, 1, -40)
- contentFrame.Position = UDim2.new(0, 5, 0, 35)
- contentFrame.BackgroundTransparency = 1
- contentFrame.Parent = frame
- -- Folder toggle button
- local docFolderButton = Instance.new("TextButton")
- docFolderButton.Text = "[+] Department of Corrections"
- docFolderButton.Size = UDim2.new(1, 0, 0, 25)
- docFolderButton.BackgroundColor3 = Color3.fromRGB(45, 45, 45)
- docFolderButton.TextColor3 = Color3.new(1, 1, 1)
- docFolderButton.Parent = contentFrame
- -- Container for DoC roles
- local docContainer = Instance.new("Frame")
- docContainer.Size = UDim2.new(1, 0, 0, 0)
- docContainer.Position = UDim2.new(0, 0, 0, 25)
- docContainer.BackgroundTransparency = 1
- docContainer.Visible = false
- docContainer.Parent = contentFrame
- -- Role List
- local rolesList = {
- "Inmate",
- "Sheriffs Office",
- "State Police",
- "Civilian",
- }
- local docRoles = {
- "Correctional Officer",
- "Medical Staff",
- "Janitor",
- "Canteen Staff",
- "Director",
- "Maintenance",
- "Assistant Director",
- "CERT",
- "Riot Officer",
- "Facility Employee",
- }
- -- Function to create checkboxes
- local function createCheckbox(parent, roleName, order)
- local button = Instance.new("TextButton")
- button.Size = UDim2.new(1, -5, 0, 25)
- button.Position = UDim2.new(0, 5, 0, (order-1) * 25)
- button.Text = "[ ] " .. roleName
- button.TextColor3 = Color3.new(1, 1, 1)
- button.BackgroundColor3 = Color3.fromRGB(55, 55, 55)
- button.Parent = parent
- local selected = false
- button.MouseButton1Click:Connect(function()
- selected = not selected
- if selected then
- button.Text = "[X] " .. roleName
- trackedRoles[roleName] = true
- else
- button.Text = "[ ] " .. roleName
- trackedRoles[roleName] = nil
- end
- end)
- end
- -- Create top-level role checkboxes
- for i, role in ipairs(rolesList) do
- createCheckbox(contentFrame, role, i+1) -- +1 for after DoC button
- end
- -- Create DoC role checkboxes
- for i, role in ipairs(docRoles) do
- createCheckbox(docContainer, role, i)
- end
- docContainer.Size = UDim2.new(1, 0, 0, #docRoles * 25)
- -- Toggle DoC folder
- local docOpen = false
- docFolderButton.MouseButton1Click:Connect(function()
- docOpen = not docOpen
- docContainer.Visible = docOpen
- docFolderButton.Text = (docOpen and "[-] " or "[+] ") .. "Department of Corrections"
- end)
- -- Minimize
- local minimized = false
- minimizeButton.MouseButton1Click:Connect(function()
- minimized = not minimized
- if minimized then
- contentFrame.Visible = false
- docContainer.Visible = false
- frame.Size = UDim2.new(0, 260, 0, 30)
- minimizeButton.Text = "+"
- else
- contentFrame.Visible = true
- frame.Size = UDim2.new(0, 260, 0, 320)
- minimizeButton.Text = "-"
- end
- end)
- -- Notify function
- local function notifyAvailable(roleName)
- StarterGui:SetCore("SendNotification", {
- Title = "Role Available!",
- Text = roleName .. " has an open spot!",
- Duration = 5
- })
- end
- -- Check function
- local function checkAvailability()
- for roleName, _ in pairs(trackedRoles) do
- local team = Teams:FindFirstChild(roleName)
- if team then
- local maxPlayers = team:FindFirstChild("MaxPlayers")
- if maxPlayers and maxPlayers:IsA("IntValue") then
- if #team:GetPlayers() < maxPlayers.Value then
- notifyAvailable(roleName)
- end
- else
- -- For unique roles like Director
- if roleName == "Director" and #team:GetPlayers() == 0 then
- notifyAvailable(roleName)
- end
- end
- end
- end
- end
- -- Loop check
- task.spawn(function()
- while true do
- checkAvailability()
- task.wait(5)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment