How would I make a GUI that would be sent to a specific player?

Hello developers,

I’m trying to make a GUI that acts like a “request,” for example; say Player 1 wants to give a tool to Player 2, Player 1 selects/types in the username of Player 2 inside of a GUI menu, and when Player 1 types/selects Player 2 in the menu, a request GUI will be sent to Player 2’s PlayerGui for him to accept/deny the request.

I currently have a RemoteFunction that takes the saved Username from the LocalScript (the username is saved when “Player 1” is selecting “Player 2” name) and sends it to the server where the Username string is stored within the Server Script. I have that Username string save to a local variable that will temporarily hold the new Username data from the RemoteFunction so I can use that in a RemoteEvent. However, this is where I get stuck.

I’ve seen possible ways of finding the specific user via PlayerService, I’ve tried going the route of doing a for _, Player in pairs(game.Players:GetPlayers()) where I try to see if the saved Username string that’s stored in the local variable matches (==) Player.Name, and if it does, it will send the GUI to the specified player, but if it does not match, it won’t perform the action.

TL:DR, I can’t get the script/events to send the request GUI to the specified player with the data stored via in the serverscript.

I still have not gotten anything to work to no avail.

Does anyone have an idea of how I could get this to work?

If you have the GUI set up I could make you a script for it. Your idea of using, for I, players in pairs(game.Players:GetChildren()) is good

Try Using Remote Events and Remote Functions, Try like Sending Player 1 request to the server using a Remote Event then the Server Sends a Remote Function To Player 2 when player 2 Gives a answer it returns true or false (Yes Or No) If True then the server takes from Player 1 Backpack the tool and sends it over to player 2

2 Likes

I got it to work, I essentially redid my coding n stuff, and kept your idea in mind. What I had partially fell into what you suggested. Thanks again!

1 Like