How to make a GUI appear for Everyone when i click another GUI

Hi im trying to make a GUI appear on everyone screens when i click a button on my GUI.

I have tried having local scripts which fire remote events and this wasnt working.

I currently have a server script which says

game.StarterGui.Admin1.Admin1.ALERT.MouseButton1Click:Connect(function()
	
	game.StarterGui.ALERTTOP.TextLabel.Visible = true
	
	wait(5)
	game.StarterGui.ALERTTOP.TextLabel.Visible = false
	
end)

But this doesnt work either. If anyone knows how to help please let me know! Thankyou

You need to create a remote event, in ReplicatedStorage.

Then put this in a local script in your button:

YourObject.MouseButton1Click:Connect(function()
    game.ReplicatedStorage.RemoteEvent:FireServer()
end)

And add this into your server script:

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(Player)
     for i,v in pairs(game.Players:GetPlayers())
       local ui = -- GUI location
       ui:Clone().Parent = v.PlayerGui
   end
end)
1 Like

i added this and it still doesnt work

Are you getting an error or anything in output?

1 Like

no its not giving any errors or anything

Fixed it using:

local Players = game:GetService("Players")

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function()
	
		for i, player in ipairs(Players:GetPlayers()) do
			task.spawn(function()
				local PlayerGui = player:WaitForChild("PlayerGui")
				PlayerGui.ALERTTOP.TextLabel.Visible = true

				task.wait(3)
				PlayerGui.ALERTTOP.TextLabel.Visible = false
			end)
		end
	end)
	
2 Likes

Similarly like what @ dreamyymax said, use remote events. This is one way i’d approach this:

Try adding two remote events in replicated storage.
Then, insert a localscript within the button:

local Appear = script.Parent.Parent.Frame -- The object you want to be appear on all screens
local button = script.Parent -- the textbutton/imagebutton you are going to press on


--events:
local event = game:GetService("ReplicatedStorage").RemoteEvent
local event2 = game:GetService("ReplicatedStorage").RemoteEvent2

button.MouseButton1Click:Connect(function()
	event:FireServer()
end)

event2.OnClientEvent:Connect(function()
	Appear.Visible = true
end)

Add a script inside serverscriptservice:

local event = game:GetService("ReplicatedStorage").RemoteEvent
local event2 = game:GetService("ReplicatedStorage").RemoteEvent2

event.OnServerEvent:Connect(function(plr)
	event2:FireAllClients()
end)
1 Like

Kon’nichiwa! :bowing_woman:t2:
Local Script

local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local PlayerGui = Players.PlayerGui
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvent_ToServer = ReplicatedStorage:WaitForChild("Admn1")
local RemoteEvent_ToClient = ReplicatedStorage:WaitForChild("Admn2")

local SpamWait = 2 --How long you want to wait until the button can be pressed again.
local Ran = false
PlayerGui.Admin1.Admin1.ALERT.MouseButton1Click:Connect(function()
	if Ran == false then
		Ran = true
		RemoteEvent_ToServer:FireServer("AlertAll")
		wait(SpamWait)
		Ran = false
	end
end)

--Remote Event detecting the signal from the server to show the UI.
RemoteEvent_ToClient.OnClientEvent:Connect(function(Action,Value)
	if Action == "AlertShow" then
		PlayerGui.ALERTTOP.TextLabel.Visible = Value
	end
end)

Server Script

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local StarterGui = game:GetService("StarterGui")

--Creates the RemoteEvents that your local script will look for.
local RemoteEvent_ToServer = Instance.new("RemoteEvent")
RemoteEvent_ToServer.Name = "Admn1"
local RemoteEvent_ToClient = RemoteEvent_ToServer:Clone()
RemoteEvent_ToClient.Name = "Admn2"
RemoteEvent_ToServer.Parent = ReplicatedStorage
RemoteEvent_ToClient.Parent = ReplicatedStorage

local Admins = {"t3h1dy",81118123}--Table of admins using username or UserId. Change the table to nil to have no admin check.
--Detects the RemoteEvent fired when the admin pressed the button (to make the ALERTTOP visible to everyone)
RemoteEvent_ToServer.OnServerEvent:Connect(function(Player,Action)
	if Action == "AlertAll" and (Admins == nil or table.find(Admins,Player.Name) or table.find(Admins,Player.UserId)) then --Checks if the person really is an admin on the list.
		StarterGui.ALERTTOP.TextLabel.Visible = true
		RemoteEvent_ToClient:FireAllClients("AlertShow",true)
		wait(5)
		StarterGui.ALERTTOP.TextLabel.Visible = false
		RemoteEvent_ToClient:FireAllClients("AlertShow",false)
	end
end)

This might help as an alternative, and can help you as you continue to develop, good luck with your project.

That is super dangerous because hackers can activate that remote event at any time.

edit: sorry i didn’t mean to revive, i didn’t realize this was from 1 year ago.