I am getting some errors

local Player = game.Players.LocalPlayer
local AssignGUI = script.Parent
local NameBox = AssignGUI.NameBox
local AssignButton = AssignGUI.AssignButton


local function getPlayerFromPartialName(PartialName)
	local foundName = nil
	local Players = game.Players:GetPlayers()
	for i = 1, #Players do
		local PossiblePlayer = Players[i]
		if string.find(string.lower(PossiblePlayer.Name), string.lower(PartialName)) then
			foundName = PossiblePlayer.Name
		end
	end
	
	if not foundName then
		return nil
	else
		return foundName
	end
end

AssignGUI.GreenTagButton.MouseButton1Click:Connect(function()
	AssignGUI.SelectedTagText.Text = "Selected Tag: Green"

AssignGUI.YellowTagButton.MouseButton1Click:Connect(function()
	AssignGUI.SelectedTagText.Text = "Selected Tag: Yellow"
		
AssignGUI.RedTagButton.MouseButton1Click:Connect(function()
	AssignGUI.SelectedTagText.Text = "Selected Tag: Red"
			
AssignGUI.BlackTagButton.MouseButton1Click:Connect(function()
	AssignGUI.SelectedTagText.Text = "Selected Tag: Black"
				
AssignButton.MouseButton1Click:Connect(function()
	local NameBoxText = NameBox.Text
		if NameBoxText ~= "" then
		local playerName = getPlayerFromPartialName(NameBoxText)
		if playerName then
			print("Found player")
			NameBox.Text = ""
			NameBox.PlaceholderText = "Assigned!"
			wait(1)
			NameBox.PlaceholderText = "Player Name Here"
		else
			NameBox.Text = ""
			NameBox.PlaceholderText = "Player Not Found!"
			wait(1)
			NameBox.PlaceholderText = "Player Name Here"
		end
	end
end)
local Player = game.Players.LocalPlayer
local AssignGUI = script.Parent
local NameBox = AssignGUI.NameBox
local AssignButton = AssignGUI.AssignButton


local function getPlayerFromPartialName(PartialName)
	local foundName = nil
	local Players = game.Players:GetPlayers()
	for i = 1, #Players do
		local PossiblePlayer = Players[i]
		if string.find(string.lower(PossiblePlayer.Name), string.lower(PartialName)) then
			foundName = PossiblePlayer.Name
		end
	end

	if not foundName then
		return nil
	else
		return foundName
	end
end

AssignGUI.GreenTagButton.MouseButton1Click:Connect(function()
	AssignGUI.SelectedTagText.Text = "Selected Tag: Green"
end)

AssignGUI.YellowTagButton.MouseButton1Click:Connect(function()
	AssignGUI.SelectedTagText.Text = "Selected Tag: Yellow"
end)

AssignGUI.RedTagButton.MouseButton1Click:Connect(function()
	AssignGUI.SelectedTagText.Text = "Selected Tag: Red"
end)

AssignGUI.BlackTagButton.MouseButton1Click:Connect(function()
	AssignGUI.SelectedTagText.Text = "Selected Tag: Black"
end)

AssignButton.MouseButton1Click:Connect(function()
	local NameBoxText = NameBox.Text
	if NameBoxText ~= "" then
		local playerName = getPlayerFromPartialName(NameBoxText)
		if playerName then
			print("Found player")
			NameBox.Text = ""
			NameBox.PlaceholderText = "Assigned!"
			wait(1)
			NameBox.PlaceholderText = "Player Name Here"
		else
			NameBox.Text = ""
			NameBox.PlaceholderText = "Player Not Found!"
			wait(1)
			NameBox.PlaceholderText = "Player Name Here"
		end
	end
end)

You were just missing a lot of end statements on those events connected to anonymous functions.

1 Like

You aren’t closing your connections, so your first GreenTagButton click is endless. Change each of the connections to look like:

AssignGUI.GreenTagButton.MouseButton1Click:Connect(function()
	AssignGUI.SelectedTagText.Text = "Selected Tag: Green"
end)--you were missing end)
1 Like