As you yourself said, this can be done with :FireAllClients(), if you want to learn more about it you can have a look here: Roblox Wiki Page - Fire All Clients
For this you also need to know a bit about Server Event. You can find this in roblox wikia: Roblox Wiki Page - OnServerEvent
You can also learn more about RemoteEvents, just click here: Roblox Wiki Page - RemoteEvents
You must first use a RemoteEvent
Create a RemoteEvent and put on ReplicatedStorage, name this as Event (You can choose the name, but if you do not want to edit the script you can leave it with that name that I said.)
Create a Script (Server Script) in ServerScriptService
And put this code:
local event = game.ReplicatedStorage.Event
event.OnServerEvent:Connect(function(plr,name)
if plr.Name == (name) then
game.ReplicatedStorage.Event:FireAllClients(plr);
else
plr:Kick("Do not use exploits!")
end
end)
Now create a LocalScript And put LocalScript in your button. and put this code:
repeat wait() until game.Players.LocalPlayer
local whitelistname = {"Avia_Robby"}
local Player = game.Players.LocalPlayer
local client = game:GetService("ReplicatedStorage").Event
client.OnClientEvent:Connect(function(plr)
for i,v in pairs(game:GetService("Players"):GetPlayers()) do
script.Parent.Parent.Parent.NoGame.Visible = false
script.Parent.Parent.Parent.Waiting.Visible = true
end
end)
script.Parent.MouseButton1Click:Connect(function()
for i,v in pairs(whitelistname) do
if Player.Name == v then
client:FireServer(v);
end
end
end)
:FireAllClients() can only be used by the server, then I made a connection with the server, and the server gives :FireAllClients() and all players will receive the GUI, Why will they receive the GUI? Because when giving FireAllClients you have access to all items of the PlayerGUI because the Client have the GUI's then you have access to everything and can change things.
Not works? tell-me on comments
Good luck in your game! :)
4 comments
https://scriptinghelpers.org/blog/it-works-in-studio-but-not-online
The last example of this blog post fits what you want, but of course a few modifications will need to be made.
:connect is deprecated use :Connect instead
in server scripts, i've gotten it to work with a for loop