Ui showing for all players instead of one

Ui showing for all players instead of one.


So I made a ClickDetector that fires a RemoteEvent in client. When that RemoteEvent is fired, it fires another one to server:

image

this is the second remote event script that works when the previous one is fired:

image

The thing is I want it to work for only the player that initially used the ClickDetector instead of showing up the ui to everybody. How do I do that? I thought of somehow making the first RemoteEvent script save the player name, and then make the second RemoteEvent script pop up the ui to the name that was saved, but I don’t know how to move those strings from event to event, and if it would work.
If anyone knows how to do it, or thinks they can help, I’d really appreciate it! :grin:

The server can’t access PlayerGui, just looping through the players on the client and changing the ui

Edit: didn’t read the last part sorry, instead of firing to the client and then to the server, just fire to the client (the one that pressed the button) and change the ui

The server can? For my spin system I couldn’t handle the system there so to make the gui say what I got I had to access the playergui.

I’m pretty sure it does work, since I made it work, just for every player lol.

Just put this code on the OnClientEvent and don’t fire a remote.

Wasn’t me who said that lol oof

The thing is the ui has buttons that will do a server function (Changing a brick for all players to see) if the ui is local, will it still work?

Yes it would! The scripts are inside of the gui right? Just fire an event if they click on a button locally. Your aloud to handle it there.

Yeah they’re local, I will make it so when you press the button, it fires a Server script doing the function!!

Yep! Then you will have no problem cloning it on the client.

Couple of things:

  1. Why are you doing a Client → Server → Client type of communication when you all you need to do is have a Server → Client.

The server detects and verifies when the ClickDetector is clicked → The server fires all clients displaying whatever you need it to.

  1. You don’t need to repeat your code using the if statement if its exactly the same. You can pretty much just do:
if player.PlayerGUI:FindFirstChild("Santa") then
    player.PlayerGui.Santa:Destroy()
end;

-- continue the rest of your code here
  1. As stated in point number 1, you can pretty much do all of this on the client and instead of having a script and ServerEvent. You can have a local script, etc

I fixed it so don’t worry anyone, I’m so thankful. :grin: