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.
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.
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!