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

How would I access another player's StarterGui?

Asked by 5 years ago

So let's say I have a textlabel in Player 1 StarterGui and I want to clone it and put it specifically in Player 2's StarterGui, how would I go about scripting and accessing Player 2's StarterGui or am I trying to script this the wrong way?

2
There is unfortunately no peer-to-peer communication, so you'd be forced to use remote events/functions to transfer from the donor to the server and from the server to the recipient. BlueGrovyle 278 — 5y
0
Thanks for the response:) iiAsianVibez 0 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago

So how you would do this is simple, though you'd have to use client-server-client communication.

First, create a RemoteFunction in ReplicatedStorage.

!

Then, you want to make a Script in ServerScriptService.

!

From there you'll go into the script and type the following:

local repStorage = game:GetService("ReplicatedStorage")

local remoteFunction = repStorage.RemoteFunction



remoteFunction.OnServerInvoke = function(player1, player2, gui)

gui:Clone().Parent = player2.PlayerGui

end

Then, you'll make a LocalScript inside of the ScreenGui you're trying to clone.

!

Inside of the LocalScript, you will put this.

local repStorage = game:GetService("ReplicatedStorage")

local remoteFunction = repStorage.RemoteFunctionprint("Hello world!")

local guiObject = script.Parent



remoteFunction:InvokeServer("PlayerNameHere", guiObject)

This should work fine. The InvokeServer function takes a Player's name as an argument, and the gui you're trying to clone.

If you need any more help, let me know.

0
This is how to clone something into another player's PlayerGui, you can access their PlayerGui with basically the same process. TheGalaxyRBLX 222 — 5y
0
Thanks for the response:) iiAsianVibez 0 — 5y
0
No problem! If you need any more help you can DM me on discord at Galaxy#0420 TheGalaxyRBLX 222 — 5y
Ad

Answer this question