My own Invite system is not working

Hello, I made an invite system for my hotel game that would if I write the player name in the text box
and press the button it will make pop up to the player I wrote , I’m using a remote event and :FireClient ,

Here is the GUI local script:

local playerName = script.Parent.Text
local MakeInviteVisible = game.ReplicatedStorage.MakeInviteVisible


script.Parent.Parent.TextButton.MouseButton1Click:Connect(function()
	
	if game.Players:FindFirstChild(playerName) then
		MakeInviteVisible:FireClient(game.Players:FindFirstChild(playerName))
	end

end)

Here is the player script:

game.ReplicatedStorage.MakeInviteVisible.OnClientEvent:Connect(function(plr,InviteGui)
	plr.PlayerGui.invsystem.recievingInv.Visible = true
end)

You are firing Client in local script?
Change :
MakeInviteVisible:FireClient()
to:
MakeInviteVisible:FireServer()

Still not working.

so I tried to change it.

You can’t call FireClient in Local Script I tried and it give me that error.
2021-01-12

So what should I do???

(Thank you for trying to help me).

You can use script in the GUI instead of local, and use RemoteFunction that returns the Box Text.

How would I do that?

(Thanks!!!)

How would I do that?

(Thanks!!)

In server Script:

    local MakeInviteVisible = game.ReplicatedStorage.MakeInviteVisible
script.Parent.Parent.TextButton.MouseButton1Click:Connect(function()
	local playerName = script.Parent.RemoteFunction:InvokeClient(script.Parent.Parent.Parent.Parent)--The player
	if game.Players:FindFirstChild(playerName) then
		MakeInviteVisible:FireClient(game.Players:FindFirstChild(playerName))
	end
end)

That’s how my Explorer looks:
2021-01-12 (5)

Then in the local script:

script.Parent.RemoteFunction.OnClientInvoke = function()
return script.Parent.Text
end

Its giving me this error at line 3:

 InvokeClient: player argument must be a Player object 

in the server script.

Yea you need to call player. By calling the startergui parent

I don’t know why I made it that complex. But there is another easier way. By calling the server to send the invite to that person.

So how would I implement this?

(Thank you.)

Like what I did.

script.Parent.Parent.Parent – That would be the PlayerGui
script.Parent.Parent.Parent.Parent – That would be the Player Him self

I mean how would i send traffic to the server ??? Remote event?

Look just use easier way like I told you first. Change FireClient to FireServer, then make the server listen to that and send the invite to the client.

		MakeInviteVisible:FireServer(game.Players:FindFirstChild(playerName))

ON server script:

MakeInviteVisible.OnServerEvent:Connect(function(player, PlayerToInvite)
MakeInviteVisible:FireClient(PlayerToInvite)
end)

Its still not working…

(Thank you for trying to help me!!!)

Show me your explorer and your script that you edited.

Yeah also put the

After MouseButton1Click cause the variable changes and you need to call it again