Changing text from serverscript when gui is cloned in localscript

How do I change the text of a gui in a server script when the gui is cloned in a local script? Thanks!
( since the serverscript won’t find the gui when the gui is cloned in a localscript )

Whilst cloning the GUI, you then tell a local script using a remote event to change the text.

Instead of updating GUI from the server-side, which is probably the worst thing you could do, you should instead use RemoteEvents.

Something like this:

Client Side

local TextLabel = path.to.TextLabel
local RemoteEvent = path.to.RemoteEvent

RemoteEvent.OnClientEvent:Connect(function(Text)
     TextLabel.Text = Text
end)

Server Side

local RemoteEvent = path.to.RemoteEvent

RemoteEvent:FireClient(Player, "some text")

my situation is something like when client A presses the button it changes a textlabel’s text to something else for every single client but not only client A

Then you could use RemoteEvent:FireAllClients("some text")

Yes but it’s not detected from the server, it’s when a client presses a button it changes the text to everyone. I think I can do something like client presses button it sends remote event to server and the server fire all client to change the text. Is this right?

Sure, that should work (very well)

1 Like