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

Cloning gui to every client, wont show up on everyones screen at the same time?

Asked by
iladoga 129
6 years ago

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!

0
If CodeTheIdiot's answer solved your problem and you acknowledge that you should accept the answer. User#19524 175 — 6y
0
it didnt solve my answer I solved it by myself.. iladoga 129 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

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)
0
Thank you! I managed to solve this a few minutes after Posting this, but Yes I did do a similar thing, having the gui in replicated storage and having a local script which when received a client event and updated the gui with args and then cloned it into the players playergui, Thank you! iladoga 129 — 6y
Ad

Answer this question