✓ Accepted answer
As Block_manvn said, use a RemoteFunction. A RemoteFunction allows a client to get something that they can't access by using the server, then the server brings the information back to the client, and vice versa. If you don't know what a client is, a client is pretty much on the player's side. The client is what the player sees on their screen. The server is from ROBLOX. It controls what happens in the game.
So you're correct, the server cannot grab from a TextBox because it's local to the client. This is why you must use a RemoteFunction. A RemoteFunction will allow the server to tell the client to get this information for it. Make sure you insert a RemoteFunction somewhere. I'll just pretend mine is in ReplicatedStorage.
Server Script
game.ReplicatedStorage.RemoteFunction:InvokeClient()
Local Script
game.ReplicatedStorage.RemoteFunction.OnClientInvoke:Connect(function()
local text = game.Players.LocalPlayer.PlayerGui.ScreenGui.TextBox.Text
return text
end
ServerScript (same script as before but adding something because text is returned)
game.ReplicatedStorage.RemoteFunction:InvokeClient()
print(text)
Hope this helps! If you don't want to return information, you can use a RemoteEvent. It's not that different. You can go to the link that Block_manvn provided to learn more.
4 comments
do :GetProperyChangedEvent("Text")
You have to use the Text value as an instance. For Instance if my Text GUI means that my life is going down the hill then it is what it is
Use RemoteEvent https://developer.roblox.com/en-us/articles/Remote-Functions-and-Events
omg, how will remote events work? they are events, this is not an event im trying to figure out how to find local text