Players not receiving invites

I’m making a matchmaking system, and i’ve ran into a lot of problems.
I managed to solve 90% of them.
But, theres one issue.
Players are not receiving invites.
Client and server are mainly communicating between remote functions.
Servercode:

local parties = {
}
local function inv(who,inviting)
	game.ReplicatedStorage.matchmaking.sendinvite:InvokeClient(inviting,who)
end
game.ReplicatedStorage.matchmaking.invite.OnServerInvoke = inv
local function sendinv(who,bool,sender)
	if parties[sender.Name] then
		if bool == true then
			table.insert(parties[sender],who.Name)
			game.ReplicatedStorage.matchmaking.invite:InvokeClient(bool)
		else
			game.ReplicatedStorage.matchmaking.invite:InvokeClient(bool)
		end
	else
		parties[sender.Name] = {}
	    if parties[sender.Name] then
		if bool == true then
			table.insert(parties[sender],who.Name)
			game.ReplicatedStorage.matchmaking.invite:InvokeClient(bool)
		else
			game.ReplicatedStorage.matchmaking.invite:InvokeClient(bool)
		end
	end
 	end
end
game.ReplicatedStorage.matchmaking.sendinvite.OnServerInvoke = sendinv

localscript MainCode for inviting players:

local List = script.Parent.Results
local partylist = script.Parent.Partylist
local close = script.Parent.Close
local Team = {}
local connectxion
function Opened()
	connectxion = game.ReplicatedStorage[".playerchanged"].OnClientEvent:connect(function()
		local ex = script.Parent.ex.user:Clone()
		ex.Parent = List
		for _,_p in pairs(game.Players:GetChildren()) do
			if _p.Name == game.Players.LocalPlayer.Name then
					-- nothing
			else
				if not _p:FindFirstChild('leaderstats') then
					repeat
						wait()
					until _p:FindFirstChild('leaderstats')
					if not List:FindFirstChild(_p.Name) then
				ex.Name = _p.Name
				ex.rate.Text = 'Rating:'.._p['leaderstats']['SuccessRate'].Value
				ex.Text = _p.Name
				ex.Visible = true
				ex.inv.MouseButton1Click:Connect(function()
					if game.Players:FindFirstChild(ex.Name) then
						local inr = game.ReplicatedStorage.matchmaking.invite
								inr:InvokeServer(game.Players[ex.Name])
								local function b(bool)
						if bool == true then
						table.insert(Team,ex.Name)
						local vx = script.Parent.plx.user:Clone()
						vx.Parent = script.Parent.Partylist
						vx.Name = ex.Name
						vx.Text = ex.Name
						vx.Visible = true
						vx.rate.Text = ex.rate.Text
						vx.rem.MouseButton1Click:Connect(function()
						   table.remove(Team,ex.Name)
								end)
							elseif bool == false then
								ex.inv.Text = 'Rejected.'
								wait(3)
								ex.inv.Text = 'Invite'
							end
						end
						inr.OnClientInvoke = b
					else
						ex:Destroy()
					end
				end)
			end
				else
					if not List:FindFirstChild(_p.Name) then
				ex.Name = _p.Name
				ex.rate.Text = 'Rating:'.._p['leaderstats']['SuccessRate'].Value
				ex.Text = _p.Name
				ex.Visible = true
				ex.inv.MouseButton1Click:Connect(function()
					if game.Players:FindFirstChild(ex.Name) then
						local inr = game.ReplicatedStorage.matchmaking.invite
								inr:InvokeServer(game.Players[ex.Name])
								local function b(bool)
						if bool == true then
						table.insert(Team,ex.Name)
						local vx = script.Parent.plx.user:Clone()
						vx.Parent = script.Parent.Partylist
						vx.Name = ex.Name
						vx.Text = ex.Name
						vx.Visible = true
						vx.rate.Text = ex.rate.Text
						vx.rem.MouseButton1Click:Connect(function()
						   table.remove(Team,ex.Name)
								end)
							elseif bool == false then
								ex.inv.Text = 'Rejected.'
								wait(3)
								ex.inv.Text = 'Invite'
							end
						end
						inr.OnClientInvoke = b
					else
						ex:Destroy()
					end
				end)
			end
				end
			end
		end
	end)
end
function Closed()
	for _,_res in pairs(List:GetChildren()) do
		if _res.Name == 'UIListLayout' then
			-- nothing
		else
			_res:Destroy()
		end
	end
	for _,_res in pairs(partylist:GetChildren()) do
		if _res.Name == 'UIListLayout' then
			-- nothing
		else
			_res:Destroy()
			Team = {}
		end
	end
	connectxion:Disconnect()
	connectxion = ''
	partylist.Visible = false
	List.Visible = false
	close.Visible = false
end
Opened()
close.MouseButton1Click:Connect(function()
	Closed()
end)

localscript Showing Invites to players:

local function z(inviting,sender)
	if inviting.Name == game.Players.LocalPlayer.Name then
	local accepted = script.Parent.bg.a
	local declined = script.Parent.bg.d
	local label = script.Parent.bg.has
	label.Text = sender.Name..[[ has invited you to their party.]]
	script.Parent.bg.Visible = true
	accepted.MouseButton1Click:Connect(function()
		script.Parent.bg.Visible = false
		game.ReplicatedStorage.matchmaking.sendinvite:InvokeServer(true,sender)
	end)
	declined.MouseButton1Click:Connect(function()
		script.Parent.bg.Visible = false
		game.ReplicatedStorage.matchmaking.sendinvite:InvokeServer(false,sender)
		end)
	else
		-- nothing
	end
end
game.ReplicatedStorage.matchmaking.sendinvite.OnClientInvoke = z

I am looking for suggestions, solutions.

First of all, I would recommend not using remote functions that fire the client as it will give an error if the player leaves or if a few other things happen. I would instead use remote events as they can just send the necessary information.

Also, are any errors appearing in the output or console? If not, I would recommend putting a bunch of prints in the code so that you can see where the code goes wrong and where the problem is.

Sorry if I couldn’t be much of a help, but I hope this helps you fix it.

there were no errors, but I found the source of the problem.
It was of

But now I just have to figure out why a value isn’t getting sent.

It looks like you are only sending two variables in the server code, yet you are supposed to receive two variables in the local script that shows the invites. The variable “inviting” in the script that shows the invites is the same as the “Who” variable in the server code because remote events and functions remove the first variable and only invokes or fires that specific client. Therefore, you can get rid of the “inviting” variable from

and you can remove

as only the specified client will receive the invoke.