Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I copy gui to player gui with FE/Experimental Mode?

I recently turned on FE and it broke this script. I'm trying to have it copy 'TheMenu' from serverstorage to player gui when I click a startergui button. I know it needs a remote event but I'm not sure where or how to use it.

function click()
local player = script.Parent.Parent.Parent.Parent

game.ServerStorage.GUI.TheMenu:clone().Parent = player.PlayerGui

end
script.Parent.MouseButton1Down:connect(click)

The hierarchy of the script is script -> text button -> screen gui -> starter gui

I know someone else asked something similar but the answer wasn't too helpful to this script.

2 comments

0

Are you trying to make it where if you click the button it makes a frame popup?

0

It makes a screen gui that contains a frame pop up

2 answers

✓ Accepted answer

Ayee there, use a server script to clone GUIs or anything else from the serverstorage since clients can't access it.

Also make a remote event in the replicated storage for this to work~

This is one way you can do it :

|Client|

local ShowGui = game.ReplicatedStorage.RemoteEvent

script.Parent.Parent.Parent.MouseButton1Click:connect(function()
ShowGui:FireServer()
end)

|Server|

local ShowGui = game:GetService("ReplicatedStorage").RemoteEvent

ShowGui.OnServerEvent:connect(function(player)
game.ServerStorage.GUI.TheMenu:Clone().Parent = player:WaitForChild("PlayerGui")
or game.ServerStorage.GUI.TheMenu:Clone().Parent = player:FindFirstChild("PlayerGui")
end)

Hope this helps!, please respond if this works.

19 comments

0

So does this go in two seperate scripts or do I put them both in the same one? I'm new to this area of scripting so I have a lot of questions.

0

The client one can go into the player's StarterGui, Starterpack, or StarterPlayerScripts. The Server script is a script in the serverscriptservice

0

It says there is an unexpected identifier near the = on line 5 of the server script.

0

On line five its supposed to be or game.ServerStorage.Gui.TheMenu:Clone().Parent == player:FindFirstChild("PlayerGui")

0

Now it's saying RemoteEvent isnt a part of repstorage in line 1 of the Server-side script.

0

You have to insert a RemoteEvent into the ReplicatedStorage for this to work. And yeah on line five its suppose to be what saSlol2436 said

0

Was I supposed to be using a local script for the client?

0

Yeah

0

Thank you so much for the help!

0

One last question, I have multiple gui that i need to be openable, so should I rename the remote events for each one, have just one remote event, or have one for each gui.

0

Keep everything the same but just add another line make it visible in the server script

0

What should be in the line and how would I make it visible? And do I just keep it all in one server script? I dont have any experience with remote events so I have to ask about everything.

0

The line where you did : game.ServerStorage.GUI.TheMenu:Clone().Parent = player:WaitForChild("PlayerGui"). Under it write game.ServerStorage.GUI.GUINAMEHERE:Clone().Parent = player:WaitForChild("PlayerGui"). If you need more help, if you have discord so i can explain better

0

I dont have a discord, sorry about that. What I meant in the question was that I have different buttons that each open their own gui. Not one button that opens them all.

0

Oh if you have different buttons, you can use different remote events. Just do the same thing but change the mouesbutton1click function and add a new event

0

So I dont need to have different names? Also, should I keep the server-side stuff all in one script or in seperate scripts?

0

Yeah different names on the remote events. And i use different scripts to connect different remote events

0

Okay, thanks.

0

Np

Here is the answer probably :connect()and :clone() is depricated Use :Connect and :Clone() instead And also use a local script instead of a global script

function click()
local player = game.Players.LocalPlayer

game.ServerStorage.GUI.TheMenu:Clone().Parent = player:WaitForChild("PlayerGui")

end
script.Parent.MouseButton1Down:Connect(click)

I always recommend using local scripts if you are using it under StarterGui, StarterPack and StarterPlayer Please submit this answer if it worked!

4 comments

0

local scripts can't access serverstorage...

0

Should I also replace :remove() with :Remove()?

0

:Remove()

0

Yeah use Remove()

This discussion is preserved as it was. New answers, comments, and votes are closed.