✓ Accepted answer
Hi! Unlike a clickdetector you can not detect who clicked a GUI, which is why people use local scripts for them.
So first, make a local script, then make this the code
script.Parent.MouseButton1Click:Connect(function()
local player = game.Players.LocalPlayer
local LobbyCopy = game.Lighting.LobbyGui:Clone()
LobbyCopy.Parent = player.PlayerGui
end)
Even though this is only for the client, it doesn't matter, as no matter what nobody else can see your GUIs.
If you really want, you could use a remote event to do this, for example, if you need to access the gui from a server script.
In that case, Make a remote event in ReplicatedStorage, Call it "RemoteEvent"
make a local script with this as the code
script.Parent.MouseButton1Click:Connect(function()
local remote = game.ReplicatedStorage.RemoteEvent
remote:FireServer()
end)
Then make a server script with this code
local remote = game.ReplicatedStorage.RemoteEvent
remote.OnServerEvent:Connect(function(player)
local LobbyCopy = game.Lighting.LobbyGui:Clone()
LobbyCopy.Parent = player.PlayerGui
end)