veosmh

roblox valley prison test script 1029

Aug 30th, 2025 (edited)
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 5.23 KB | Gaming | 0 0
  1. -- LocalScript (StarterPlayerScripts OR executor loadstring)
  2.  
  3. local Players = game:GetService("Players")
  4. local Teams = game:GetService("Teams")
  5. local StarterGui = game:GetService("StarterGui")
  6.  
  7. local player = Players.LocalPlayer
  8.  
  9. -- TRACKING TABLE
  10. local trackedRoles = {}
  11.  
  12. -- GUI CREATION
  13. local screenGui = Instance.new("ScreenGui")
  14. screenGui.Name = "RoleNotifier"
  15. screenGui.Parent = player:WaitForChild("PlayerGui")
  16.  
  17. local frame = Instance.new("Frame")
  18. frame.Size = UDim2.new(0, 260, 0, 320)
  19. frame.Position = UDim2.new(0, 50, 0, 200)
  20. frame.BackgroundColor3 = Color3.fromRGB(35, 35, 35)
  21. frame.Active = true
  22. frame.Draggable = true -- allows moving
  23. frame.Parent = screenGui
  24.  
  25. local title = Instance.new("TextLabel")
  26. title.Text = "Role Notifications"
  27. title.Size = UDim2.new(1, 0, 0, 30)
  28. title.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
  29. title.TextColor3 = Color3.new(1, 1, 1)
  30. title.Font = Enum.Font.SourceSansBold
  31. title.TextSize = 18
  32. title.Parent = frame
  33.  
  34. -- Minimize Button
  35. local minimizeButton = Instance.new("TextButton")
  36. minimizeButton.Text = "-"
  37. minimizeButton.Size = UDim2.new(0, 30, 0, 30)
  38. minimizeButton.Position = UDim2.new(1, -30, 0, 0)
  39. minimizeButton.BackgroundColor3 = Color3.fromRGB(80, 80, 80)
  40. minimizeButton.TextColor3 = Color3.new(1, 1, 1)
  41. minimizeButton.Parent = frame
  42.  
  43. local contentFrame = Instance.new("Frame")
  44. contentFrame.Size = UDim2.new(1, -10, 1, -40)
  45. contentFrame.Position = UDim2.new(0, 5, 0, 35)
  46. contentFrame.BackgroundTransparency = 1
  47. contentFrame.Parent = frame
  48.  
  49. -- Folder toggle button
  50. local docFolderButton = Instance.new("TextButton")
  51. docFolderButton.Text = "[+] Department of Corrections"
  52. docFolderButton.Size = UDim2.new(1, 0, 0, 25)
  53. docFolderButton.BackgroundColor3 = Color3.fromRGB(45, 45, 45)
  54. docFolderButton.TextColor3 = Color3.new(1, 1, 1)
  55. docFolderButton.Parent = contentFrame
  56.  
  57. -- Container for DoC roles
  58. local docContainer = Instance.new("Frame")
  59. docContainer.Size = UDim2.new(1, 0, 0, 0)
  60. docContainer.Position = UDim2.new(0, 0, 0, 25)
  61. docContainer.BackgroundTransparency = 1
  62. docContainer.Visible = false
  63. docContainer.Parent = contentFrame
  64.  
  65. -- Role List
  66. local rolesList = {
  67.     "Inmate",
  68.     "Sheriffs Office",
  69.     "State Police",
  70.     "Civilian",
  71. }
  72.  
  73. local docRoles = {
  74.     "Correctional Officer",
  75.     "Medical Staff",
  76.     "Janitor",
  77.     "Canteen Staff",
  78.     "Director",
  79.     "Maintenance",
  80.     "Assistant Director",
  81.     "CERT",
  82.     "Riot Officer",
  83.     "Facility Employee",
  84. }
  85.  
  86. -- Function to create checkboxes
  87. local function createCheckbox(parent, roleName, order)
  88.     local button = Instance.new("TextButton")
  89.     button.Size = UDim2.new(1, -5, 0, 25)
  90.     button.Position = UDim2.new(0, 5, 0, (order-1) * 25)
  91.     button.Text = "[ ] " .. roleName
  92.     button.TextColor3 = Color3.new(1, 1, 1)
  93.     button.BackgroundColor3 = Color3.fromRGB(55, 55, 55)
  94.     button.Parent = parent
  95.  
  96.     local selected = false
  97.     button.MouseButton1Click:Connect(function()
  98.         selected = not selected
  99.         if selected then
  100.             button.Text = "[X] " .. roleName
  101.             trackedRoles[roleName] = true
  102.         else
  103.             button.Text = "[ ] " .. roleName
  104.             trackedRoles[roleName] = nil
  105.         end
  106.     end)
  107. end
  108.  
  109. -- Create top-level role checkboxes
  110. for i, role in ipairs(rolesList) do
  111.     createCheckbox(contentFrame, role, i+1) -- +1 for after DoC button
  112. end
  113.  
  114. -- Create DoC role checkboxes
  115. for i, role in ipairs(docRoles) do
  116.     createCheckbox(docContainer, role, i)
  117. end
  118. docContainer.Size = UDim2.new(1, 0, 0, #docRoles * 25)
  119.  
  120. -- Toggle DoC folder
  121. local docOpen = false
  122. docFolderButton.MouseButton1Click:Connect(function()
  123.     docOpen = not docOpen
  124.     docContainer.Visible = docOpen
  125.     docFolderButton.Text = (docOpen and "[-] " or "[+] ") .. "Department of Corrections"
  126. end)
  127.  
  128. -- Minimize
  129. local minimized = false
  130. minimizeButton.MouseButton1Click:Connect(function()
  131.     minimized = not minimized
  132.     if minimized then
  133.         contentFrame.Visible = false
  134.         docContainer.Visible = false
  135.         frame.Size = UDim2.new(0, 260, 0, 30)
  136.         minimizeButton.Text = "+"
  137.     else
  138.         contentFrame.Visible = true
  139.         frame.Size = UDim2.new(0, 260, 0, 320)
  140.         minimizeButton.Text = "-"
  141.     end
  142. end)
  143.  
  144. -- Notify function
  145. local function notifyAvailable(roleName)
  146.     StarterGui:SetCore("SendNotification", {
  147.         Title = "Role Available!",
  148.         Text = roleName .. " has an open spot!",
  149.         Duration = 5
  150.     })
  151. end
  152.  
  153. -- Check function
  154. local function checkAvailability()
  155.     for roleName, _ in pairs(trackedRoles) do
  156.         local team = Teams:FindFirstChild(roleName)
  157.         if team then
  158.             local maxPlayers = team:FindFirstChild("MaxPlayers")
  159.             if maxPlayers and maxPlayers:IsA("IntValue") then
  160.                 if #team:GetPlayers() < maxPlayers.Value then
  161.                     notifyAvailable(roleName)
  162.                 end
  163.             else
  164.                 -- For unique roles like Director
  165.                 if roleName == "Director" and #team:GetPlayers() == 0 then
  166.                     notifyAvailable(roleName)
  167.                 end
  168.             end
  169.         end
  170.     end
  171. end
  172.  
  173. -- Loop check
  174. task.spawn(function()
  175.     while true do
  176.         checkAvailability()
  177.         task.wait(5)
  178.     end
  179. end)
  180.  
Advertisement
Add Comment
Please, Sign In to add comment