Script:
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Overhead = script.OverheadGui
local AssignGUI = script.Parent
local NameBox = AssignGUI.NameBox
local AssignButton = AssignGUI.AssignButton
local Colors = {Color3.new(0, 1, 0), Color3.new(1, 1, 0), Color3.new(1, 0, 0), Color3.new(0, 0, 0)}
local ColorNames = {"Green Tag", "Yellow Tag", "Red Tag", "Black Tag"}
local Color, ColorName
AssignGUI.GreenTagButton.MouseButton1Click:Connect(function()
AssignGUI.SelectedTagText.Text = "Selected Tag: Green"
Color = Colors[1]
ColorName = ColorNames[1]
end)
AssignGUI.YellowTagButton.MouseButton1Click:Connect(function()
AssignGUI.SelectedTagText.Text = "Selected Tag: Yellow"
Color = Colors[2]
ColorName = ColorNames[2]
end)
AssignGUI.RedTagButton.MouseButton1Click:Connect(function()
AssignGUI.SelectedTagText.Text = "Selected Tag: Red"
Color = Colors[3]
ColorName = ColorNames[3]
end)
AssignGUI.BlackTagButton.MouseButton1Click:Connect(function()
AssignGUI.SelectedTagText.Text = "Selected Tag: Black"
Color = Colors[4]
ColorName = ColorNames[4]
end)
AssignButton.MouseButton1Click:Connect(function()
if Color and ColorName then
if NameBox.Text:len() >= 1 then
local FoundPlayers = {}
for _, PlayerInstance in ipairs(Players:GetPlayers()) do
if PlayerInstance.Name:lower():match("^"..NameBox.Text:lower()) then
table.insert(FoundPlayers, PlayerInstance)
end
end
NameBox.Text = ""
if #FoundPlayers == 1 then
local FoundPlayer = FoundPlayers[1]
local FoundCharacter = FoundPlayer.Character
if FoundCharacter then
local FoundHead = FoundCharacter.Head
local OldOverhead = FoundHead:FindFirstChild("OverheadGui")
if OldOverhead then
OldOverhead.InformationLabel.TextColor3 = Color
OldOverhead.InformationLabel.Text = ColorName
else
local NewOverhead = Overhead:Clone()
NewOverhead.InformationLabel.TextColor3 = Color
NewOverhead.InformationLabel.Text = ColorName
NewOverhead.Parent = FoundHead
NewOverhead.Adornee = FoundHead
end
end
NameBox.PlaceholderText = "Player found!"
elseif #FoundPlayers > 1 then
NameBox.PlaceholderText = "Too many players found!"
else
NameBox.PlaceholderText = "No player found!"
end
task.wait(1)
NameBox.PlaceholderText = "Enter a player's name here!"
end
end
end)