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

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

Asked by
Viking359 161
7 years ago

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.

0
Are you trying to make it where if you click the button it makes a frame popup? TheForgottenTale 23 — 7y
0
It makes a screen gui that contains a frame pop up Viking359 161 — 7y

2 answers

Log in to vote
0
Answered by
oSyM8V3N 429 Moderation Voter
7 years ago

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.

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. Viking359 161 — 7y
0
The client one can go into the player's StarterGui, Starterpack, or StarterPlayerScripts. The Server script is a script in the serverscriptservice oSyM8V3N 429 — 7y
0
It says there is an unexpected identifier near the = on line 5 of the server script. Viking359 161 — 7y
0
On line five its supposed to be or game.ServerStorage.Gui.TheMenu:Clone().Parent == player:FindFirstChild("PlayerGui") saSlol2436 716 — 7y
View all comments (15 more)
0
Now it's saying RemoteEvent isnt a part of repstorage in line 1 of the Server-side script. Viking359 161 — 7y
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 oSyM8V3N 429 — 7y
0
Was I supposed to be using a local script for the client? Viking359 161 — 7y
0
Yeah oSyM8V3N 429 — 7y
0
Thank you so much for the help! Viking359 161 — 7y
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. Viking359 161 — 7y
0
Keep everything the same but just add another line make it visible in the server script oSyM8V3N 429 — 7y
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. Viking359 161 — 7y
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 oSyM8V3N 429 — 7y
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. Viking359 161 — 7y
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 oSyM8V3N 429 — 7y
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? Viking359 161 — 7y
0
Yeah different names on the remote events. And i use different scripts to connect different remote events oSyM8V3N 429 — 7y
0
Okay, thanks. Viking359 161 — 7y
0
Np oSyM8V3N 429 — 7y
Ad
Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

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!

0
local scripts can't access serverstorage... aztec_glory 63 — 7y
0
Should I also replace :remove() with :Remove()? Viking359 161 — 7y
0
:Remove() saSlol2436 716 — 7y
0
Yeah use Remove() oSyM8V3N 429 — 7y

Answer this question