Goal: I am trying to make a simple HandToGUI. The purpose is to allow staff to hand items to other players.

Progress: The 1st part works correctly. It checks if the player is a staff member (in a group and if a certain rank). The 2nd part works correctly. It checks if the player (giving the item) is holding an item. If not, it changes the TextBox text to "Equip a tool first!" The 3rd and most important part does not work. It is supposed to fire a RemoteEvent named GivePlayerItem. Once the RemoteEvent is fired, it changes the text to either "Success" or "Error" depending if it worked correctly.

Problem: The 3rd part does NOT work. It does not hand the player a tool or change the text.

SCRIPTS:

"FocusLost" (local script) Located: game - StarterGui - MainFrame - TypeFrame - NameBox - FocusLost

--Variables
local Player = game.Players.LocalPlayer
local HandtoGui = script.Parent.Parent.Parent.Parent
local NameBox = script.Parent
local restrictedAreas = game.Workspace.RestrictedArea

local groupId = 3800312
local minimumRankToUseGui = 5

--If Statement
if Player:GetRankInGroup(groupId) < minimumRankToUseGui then
	HandtoGui:Destroy() --If not a staff member
else do
		restrictedAreas:Destroy() --If staff member
	end
end

--Main Text
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


script.Parent.FocusLost:Connect(function(enterPressed, inputThatCausedFocusLost)
	if enterPressed then
		if not Player.Character:FindFirstChildWhichIsA("Tool") then
			NameBox.Text = ""
			NameBox.PlaceholderText = "Equip a Tool First!"
			wait(1)
			NameBox.PlaceholderText = "Player Name Here"
		end
	else
		local NameBoxText = NameBox.Text
		if NameBoxText ~= "" then
			local playerName = getPlayerFromPartialName(NameBoxText)
			if playerName then
				game.ReplicatedStorage.GivePlayerItem:FireServer(playerName)
				NameBox.Text = ""
				NameBox.PlaceholderText = "Success!"
				wait(1)
				NameBox.PlaceholderText = "Player Name Here"
			else
				NameBox.Text = ""
				NameBox.PlaceholderText = "Error."
				wait(1)
				NameBox.PlaceholderText = "Player Name Here"
			end
		end
	end
end)

"GivePlayerItem" (RemoteEvent) Located: game - ReplicatedStorage - GivePlayerItem

"GivePlayerItem" (script) Located: game - ServerScriptService - GivePlayerItem

game.ReplicatedStorage.GivePlayerItem.OnServerEvent:Connect(function(Player, PlayerName)
	local ToolToGive = Player.Character:FindFirstChildWhichIsA("Tool")
	ToolToGive.Parent = game.Players[PlayerName].Backpack
end)

Please ask any more questions if you are having trouble what I am looking for. I would greatly appreciate anyone's help!