Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
4

How to make all players see a GUI message from server?

Asked by
trecept 367 Moderation Voter
5 years ago
Edited 5 years ago

For example if my game changes map, how do I make a GUI pop up on every player's screen saying the map name, and then deleting the GUI seconds later? (How to make the GUI pop up from a server script) I don't think it's remote events or remote functions?

(The game is FE)

0
I think you should use remove events? TheSkyofIndia 150 — 5y
0
You would have to use Remote Event and FireAllClients(); Let me know if you need an example. I think it is pretty straight forward but if you do need an example, do let me know.  Zafirua 1348 — 5y
0
Also, you don't want to utilize Server Script for any Graphic User Interface, simply because it isn't a good practice. Always use Local Script for anything related to Guis. Zafirua 1348 — 5y

1 answer

Log in to vote
2
Answered by
Amiaa16 3227 Moderation Voter Community Moderator
5 years ago

You can use RemoteEvents to tell the clients to unhide a gui with the message and change its text, and also after how many seconds it should hide it again.

Example:

Server:

local msgRemote = Instance.new("RemoteEvent") --or do it in explorer
msgRemote.Parent = game.ReplicatedStorage
msgRemote.Name = "msgRemote"

--when displaying a message for 5 seconds:
msgRemote:FireAllClients("Game will start in 5 seconds! Prepare!", 5)

Client:

local msgRemote = game.ReplicatedStorage:WaitForChild("msgRemote")

local gui = script.Parent

msgRemote.OnClientEvent:Connect(function(text, time)
    gui.Visible = true
    gui.MessageLabel.Text = text
    wait(time)
    gui.Visible = false
end)
Ad

Answer this question