I am trying to make a message system so that it sends a message out to everyone in the server in the form of a gui. This have been successful however. I noticed it takes about a minute for the message to display on every players screen. It goes from one player. To the next's screen instead of appearing on all clients at the same time. How do I solve this?
for i,v in ipairs(game:GetService("Players"):GetPlayers()) do GuiFolder.Notification:Clone().Parent = v.PlayerGui v.PlayerGui.Notification.Main.Dismiss.Text = "Hello I am using scripting helpers!" end
Thanks if anyone can solve this!
That should not take a minute (not even close, we're talking about milliseconds). However, I would use a different approach so the server does not have to do "unnecessary" stuff like cloning and parenting the ui for every notification you have.
Instead, you should have the Gui on the client already, and then use a RemoteEvent and get the server to do RemoteEvent:FireAllClients()
this would fire the same event for every player in the server, and using this approach, you also don't get the server to do unnecessary stuff.
Then, on the client you listen for events from that RemoteEvent, and once it gets fired, you display the notification.
This is a short example:
-- Server local NotificationRemote = game:GetService("ReplicatedStorage"):WaitForChild("NotificationRemote"); -- Send notification NotificationRemote:FireAllClients("I am asking for help in Scripting Helpers")
-- Client local NotificationRemote = game:GetService("ReplicatedStorage"):WaitForChild("NotificationRemote"); NotificationRemote.OnClientEvent:Connect(function(newNotification) print("New notification:", newNotification) -- Make the gui visible and update the text end)