Accessing PlayerGui in FE

I am trying to access PlayerGui ingame so I can clone a frame into a Ui List Layout but it only works in studio. It uses a Remote Event but apparently it can’t find the Ui List Layout inside PlayerGui when ingame. Please help

Server Script:
remote = game.ReplicatedStorage.Error

remote.OnServerEvent:connect(function(client)

game.Lighting.PlaceError:Clone().Parent = client.PlayerGui.Notice[“Notice Frame”]

end)

Local Script:
local remote = game.ReplicatedStorage.Error

script.Parent.MouseButton1Click:connect(function()

if game.PlaceId == 1186697681 then

remote:FireServer()

end

end)

1 Like

Alright uh, where to begin here.

The PlayerGui contents don’t replicate when filtering is enabled. Guis have to be 100% clientside.

Even with access in experimental mode, it is a horrible practice to manipulate GUI objects in a player’s PlayerGui from the server.

What are you trying to do here exactly?

1 Like

Creating a notice gui where I can simply clone various notices into a frame and compiles together using UiListLayout constraint

Okay, and is the server the one distributing these notices, or the client? If you’re just trying to have a notice that is signaled by the client for the client, use a BindableEvent.

Server distributes notices into the List

Why?

1 Like

The thing is, I need to clone a frame into a GUI but when I clone into startergui, it doesnt appear and when I clone into playergui, it appears in studio but not ingame since PlayerGui doesnt replicate

Okay, so have the server send a notice message to the client as a string via FireClient, and then the client takes this message and generates the object with the text. I think you might be misunderstanding the server-client model here a bit.

As clonetrooper said, just clone it from the client. There should be no server interaction here.

what do you mean? The different notices are stored in Lighting

So clone them from lighting, from a client script - why does a server script have to be involved here?

because the gui doesn’t appear when I clone into startergui

Storing stuff in the Lighting is like, so 2011. The server does not need to be involved with the GUI objects at all. Store these objects in a LocalScript, have the server tell the client what notification to show if it needs to, and then the client deals with the rest.

6 Likes

Why didn’t i think of that

¯\_(ツ)_/¯

1 Like

Okay back up a little here. You seem to be rushing into this concept faster than you can understand it. It’s a bit more complicated than that.

The StarterGui is not where you should be cloning to. The StarterGui stores the initial ScreenGuis that will be cloned into each players PlayerGui.

So just as a simple rundown:

  1. Make sure you’re using a LocalScript. Regular scripts will not run in guis.
  2. Assuming you’re running the script inside of a GUI, get a variable that refers to your notification container by traversing through parents until you reach a common ancestor that both the container and the script share
  3. Go through the children (via WaitForChild for safety) to access the notification container.
  4. Clone the object into there.
5 Likes

ok thx