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

How to get localplayers gui text?

Asked by 4 years ago

For example I have a gui in which the player has to type something, how can I access localplayers text through server side script?

0
You can send that information via RemoteEvent pidgey 548 — 4y
0
How would I use remoteEvent for it? Hevoxic 2 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

You could have a RemoteFunction somewhere that both the server and client can see. (Workspace or ReplicatedStorage will do just fine)

On the client, you should do:

YourRemoteFunction.OnServerInvoke = function() --replace YourRemoteFunction with your RemoteFunction's location
    return MyGui.Text --replace MyGui with wherever your GUI is located
end

This will basically say, "Hey, when the server fires this RemoteFunction, I want to give it whatever is written in MyGui.Text."

Now, on the server, you can very simply do:


local Text = YourRemoteFunction:InvokeClient(playerToSendTo) print(Text) --prints whatever they have in their text entry

Just replace playerToSendTo with the player you want to ask for the input and you should be good to go.

Ad

Answer this question