How to :FireClient()

How exactly would I fire a specific client from an argument passed with a remote function from client to server? I have a clan system and players can invite others to their clan.

So when they go to invite someone a GUI opens and it has a list of players and an invite button for each. For handling that I have this:

for i, button in pairs(clanFrame.Container.inviteFrame.ScrollingFrame:GetDescendants()) do
		if button:IsA("TextButton") then
			button.Activated:Connect(function()
				
				replicatedStorage.inviteClan:FireServer(button.Parent.Name)
			end)
		end
	end

The name of the button’s parent is the name of the player that needs to be invited. The server then :FireClient() with that argument.

function invite(reqplayer)

ReplicatedStorage.createMsg:FireClient(reqplayer)

return true

end

ReplicatedStorage.inviteClan.OnServerEvent:Connect(invite)

The reqPlayer is the client that needs to be fired. So why doenst it work? It ends up firing the client that sent it so it results in the GUI on their screen not who the invite needs to be sent to.

1 Like

ReplicatedStorage.inviteClan.OnServerEvent:Connect(invite)

When a event is fired from the client to the server, the first argument that the server receives is always the player so your code should be this.

ReplicatedStorage.inviteClan.OnServerEvent:Connect(player, invite)

Sorry, you want to make a GUI that allows player to invite others that are friends on Roblox?

SocialService does this easily.