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

How would I access another player's StarterGui?

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 comments

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.

0

Thanks for the response:)

1 answer

✓ Accepted answer

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.

3 comments

0

This is how to clone something into another player's PlayerGui, you can access their PlayerGui with basically the same process.

0

Thanks for the response:)

0

No problem! If you need any more help you can DM me on discord at Galaxy#0420

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