GUI Prompted on Certain Player

Recently I was trying to script a Hand-To GUI and I was wondering on how I can make a GUI to appear on a certain person.

Let me break it down a bit more to elaborate. What I am trying to do is make a custom GUI that can hand people items that I am holding. In this case, Player 1 is holding an item and is wanting to hand Player 2 the item. I also want Player 2 to be prompted with a GUI

How would I make it so that a certain player receives a GUI?


You could make it so after you the hand-to code set up, when it’s time to prompt it to the other player, fire a RemoteEvent, passing in the player to prompt with it, and in that RemoteEvent, Have it clone the Prompt ScreenGui into the playergui of the player that has to be prompted, changing some properties around in the GuiObjects in it, like the text to display to them and what not. And in the RemoteEevent as well, you can connect some events for when the player clicks the Yes or No buttons to do certain stuff

I’m new to coding so I’m not too familiar with events. If you don’t mind adding a little example to show on how the RemoteEvent would be triggered and how the specific Player 2’s client would be triggered?


I presume you already have the code set up for the basis of the Hand-to, firing a RemoteEvent created on the Server would use FireServer, so lets say you’re getting Player2 via a Textbox, what you can do is put the Text of the Textbox in a variable and fire it off, like so


Where RemotEvent is the RemoteEvent with code set up and handtoplr is the name of the palyer we want to give the prompt to

And in a server script, you’d just do

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player, handtoname)
	local handtoplayer = game.Players:FindFirstChild(handtoname)
	local promptgui = game.ServerStorage.PromptGUI:Clone()
	promptgui.Parent = handtoplayer.PlayerGui

As an example, the passed in player name will be used to get the player instance and put the promptgui that is in ServerStorage in our example into their PlayerGui. Since this is OnServerEvent, the first parameter is always the player who fired the event, this is given automatically so you can not give it yourself in FireServer and it’s always the first parameter given

This is the basis of how you could set it up for what you need, you’d just have to add on from there


Thank you so much for the solution.

1 Like

Anytime! If you have anymore questions about this don’t be afraid to make another reply and if you other issues don’t be afraid to make another post!

One more question, for the main script that controls the overall Hand-To, how would I specify the Player’s name. Since I have to fire the client with the Player 2’s name, how do I get the player’s name

To be more specific, what should be the code when I fire the client with their name?

I’m still not understanding slightly, how you do have the naming system set up? With a textbox to write the name of who to give to?

Yeah, I have it set up as a TextBox

How would I specifically fire the client?

May I see your script that you ahve right now for the client sided part for Hand to?

That’s the part I was stuck on, I was originally thinking on how I should fire the client but it turned out to be for something else so I erased it and came back to square one

Basically, this is how I would do the client sided part

  • Set up an event for when the player clicks on the button to send a prompt to anotehr player
  • Get the text from the Textbox
  • Fire that to the remoteEvent
local textbox = --Location of textbox

local button = script.Parent

local remote = game.ReplicatedStorage.RemoteEvent


Ah, thank you so much, this is what I was looking for.

It’s the very basis of how you can do it, I would recommend adding some checks into it, liek checking if the player is i nthe server before firing the remote to reduce unnecessary fires

How would I check to see if they are in the game?

You could do something like this

local textbox = --Location of textbutton

local button = script.Parent

local remote = game.ReplicatedStorage.RemoteEvent

	if not game.Players:FindFirstChild(textbox.Text) then return end

You are a life savior, thank you.

1 Like

Anytime! If you have anymore issues don’t be afraid to make another post!!!