How to allow ui to appear for only select users?

Hello, everyone.

How would I make ui appear for only select users?
For example, in epic mini games, it would show “well done” to only people who won the round.

Is there a way I could store all the selected users in a table, and fire only to them?
I don’t want to fire one at a time, cuz it’ll be too slow.

I would appreciate any help.

Thank you
-coolguyweir

2 Likes

There is no way to do this I don’t think, the only way is to loop through the table and change the UI. I don’t think this would make it that slow though so I would not really worry.

1 Like

thanks for the response. I’ll see what others say.

1 Like

You could do that pretty easily. I assume the request is coming from the server, so you’d just have the table of winners and use a loop to fire a RemoteEvent to the client, which simply displays the well done screen.

It would look something like this:

local Players = game:GetService("Players")

local winnerTable = {} -- Table of IDs
for _, v in pairs(winnerTable) do

   local player = Players:GetPlayerByUserID(v)
   local playerRemote = -- Where ever the remote is within the player
   playerRemote:FireClient()

end
1 Like

Well, I understand this approach completely.

But I’m saying, is there a way to apply some form of Fireallclients or basically fire all selected clients at the same time rather than loop?

1 Like

Yes there is a way,
Here is how

local table_of_players = {
"coolguyweir";
"AnimationKrazy"
}
for i = 1,#table_of_players do
local Player = table_of_players[i]
remoteevent:FireClient(Player)
end

or

for i,v in pairs(table_of_players) do
remoteevent:FireClient(v)
end
1 Like

You can see the player(s) who won and create a value with their name(s), use FireAllClients and if that client(s) found his / their name under the folder with the values than enable the gui else disabled it

1 Like

is there a winning team? just get all players and check if they are in winning team (if you want it to appear for winners)

1 Like

This would son like a cheap way to do that but maybe you could make it so when the round ends the winner is still on the platform, and you could move the Position of a part when the round ends, by touching this part it would make the gui saying “Well done” appear and disappear after a couple of seconds

1 Like

Server:

local event = somthnegng -- event here, event should be in replicated storage
local PlrsThatWon = {"Bob"}
local players = game:GetService("Players")
for i,plr in pairs(PlrsThatWon) do
	event:FireClient(players[plr])
end

Client:

local event = somengrGARG -- event used in server script
local winUI = something -- winner UI frame
event.OnClientEvent:Connect(function()
	winUI.Visible = true
	task.wait(5)
	winUI.Visible = false -- just make it disappear after 5s
end)
2 Likes
local winners = {elomala, coolguyweir, SummerLife, funniman232, Trollguy21412} --whatever the winners are
for i, v in pairs(winners) do
    local player = game:GetService("Players"):FindFirstChild(v)
    local GUI = player.PlayerGui.ScreenGui:FindFirstChild("WellDone") --whatever the GUI name is
    GUI.Visible = true
end
1 Like

You would have to get the players User ID to do this.

1 Like

Faster method would be to send the table of select users to each client via fire all clients then just do a simple if table.find(selectUsers, localplayer.UserId).

I believe you mean it this way.

Ok, the round is over you either send some event or a function when that happens and when “firing” it you send the parameter where it states who the winner is and then when on the script of the function you make a gui visible on that players playergui or just clone them a gui from somewhere.
Of course if there is many you could send the table containing all the winners too