local Players = game:GetService("Players")
local workspace = game:GetService("Workspace")
local weaponMarkers = {
    Killer = {"Sawn-off", "K1911", "RR-LightCompactPistolS", "JS2-Derringy", "KOLT-
AR15", "JS-22", "KamatovS", "Rosen-Obrez"},
    Sheriff = {"RR-Snubby", "GG-17", "IZVEKH-412"},
    HomigradTerrorist = {"VK's ANKM", "RY's GG-17", "AT's KAR15"},
    HomigradPolice = {"RR-40", "IZVEKH-412", "ZJ23M"},
    MeleeWeapons = {"Lead Pipe", "KitchenKnife", "Pen"} -- Lower priority than guns
}
-- Function to create the colored dot for the player
local function createDot(player, color)
    if player.Character and player.Character:FindFirstChild("Head") then
        local head = player.Character.Head
        local dot = head:FindFirstChild("RoleDot")
        if not dot then
            dot = Instance.new("BillboardGui")
            dot.Name = "RoleDot"
            dot.Size = UDim2.new(0, 8, 0, 8)
            dot.Adornee = head
            dot.AlwaysOnTop = true
            dot.Parent = head
                  local frame = Instance.new("Frame")
                  frame.Size = UDim2.new(1, 0, 1, 0)
                  frame.BackgroundColor3 = color
                  frame.Parent = dot
            else
                  dot.Frame.BackgroundColor3 = color
            end
      end
end
-- Function to remove the dot from the player
local function removeDot(player)
    if player.Character and player.Character:FindFirstChild("Head") then
        local head = player.Character.Head
        local dot = head:FindFirstChild("RoleDot")
        if dot then
            dot:Destroy()
        end
    end
end
-- Check if the player is completely unarmed
local function isPlayerUnarmed(player)
    local backpack = player:FindFirstChild("Backpack")
    local toolInHand = player.Character and
player.Character:FindFirstChildOfClass("Tool")
    local npcModel = workspace.NPCSFolder:FindFirstChild(player.Name)
    local npcWeapon = npcModel and npcModel:FindFirstChildOfClass("Tool")
    if not toolInHand and not npcWeapon and (not backpack or
#backpack:GetChildren() == 0) then
        return true -- No weapons at all
    end
    return false
end
-- Function to check if a player has a weapon (either equipped, in the backpack, or
NPC folder)
local function checkValidWeapon(player)
    local backpack = player:FindFirstChild("Backpack")
    local toolInHand = player.Character and
player.Character:FindFirstChildOfClass("Tool")
    local npcModel = workspace.NPCSFolder:FindFirstChild(player.Name)
    local npcWeapon = npcModel and npcModel:FindFirstChildOfClass("Tool")
      local detectedWeapon = nil
      local detectedRole = nil
      -- Check for weapons in Backpack, Hand, and NPC
      local function checkWeapon(item)
          for role, weapons in pairs(weaponMarkers) do
              if table.find(weapons, item) then
                  detectedRole = role
                  detectedWeapon = item
              end
          end
      end
      if backpack then
          for _, item in pairs(backpack:GetChildren()) do
              checkWeapon(item.Name)
          end
      end
      if toolInHand then
          checkWeapon(toolInHand.Name)
      end
      if npcWeapon then
          checkWeapon(npcWeapon.Name)
      end
      return detectedRole, detectedWeapon
end
-- Function to check if a player matches Target Hints
local function checkTargetHints(player)
    local hintsGui =
game:GetService("Players").LocalPlayer.PlayerGui:FindFirstChild("RESETONDEATHStatus
Gui")
    if hintsGui and hintsGui:FindFirstChild("TARGETHINT") then
        local hintText = hintsGui.TARGETHINT.Text
        local npcModel = workspace.NPCSFolder:FindFirstChild(player.Name)
        if npcModel and npcModel:FindFirstChild("Configuration") then
            for _, valueObj in pairs(npcModel.Configuration:GetChildren()) do
                 if valueObj:IsA("StringValue") and valueObj.Value == hintText then
                     return true -- Player matches the hint
                 end
            end
        end
    end
    return false
end
-- Function to assign dots based on role, hints, and weapons
local function assignDots()
    for _, player in pairs(Players:GetPlayers()) do
        local role, weapon = checkValidWeapon(player)
        local isHintMatch = checkTargetHints(player)
        local isUnarmed = isPlayerUnarmed(player)
        if isHintMatch then
             createDot(player, Color3.fromRGB(255, 255, 0)) -- Yellow for hint match
        elseif role then
             if role == "Killer" then
                 createDot(player, Color3.fromRGB(255, 0, 0)) -- Red for Killer
             elseif role == "Sheriff" then
                 createDot(player, Color3.fromRGB(0, 0, 255)) -- Blue for Sheriff
             elseif role == "HomigradTerrorist" then
                 createDot(player, Color3.fromRGB(255, 165, 0)) -- Orange for
Terrorist
             elseif role == "HomigradPolice" then
                 createDot(player, Color3.fromRGB(0, 0, 255)) -- Blue for Police
             end
        elseif isUnarmed then
             createDot(player, Color3.fromRGB(0, 255, 0)) -- Green for No Weapons
        else
             removeDot(player) -- Remove dot if nothing applies
        end
    end
end
-- Run the function repeatedly every -.- seconds
while true do
    assignDots()
    task.wait(0.6)
end