How do I send a StringValue from a LocalScript to a Regular script? Can this be done using ReplicatedStorage?
No, it cannot. Changes the client makes to ReplicatedStorage will not be made on the server.
Client-server communication is done with RemoteEvents and RemoteFunctions.
What you need to do is use a remote event to pass on the information, you can also use a Remote Function if you need to return something back to the client. If what @nicemike40 said didn’t help you, I need you to elaborate on your situation.
I get that, but I have a text box GUI that the player will type in. I want the text that the player enters to be displayed on a server-sided surface GUI, so that everyone can see what they typed.
Instead of using a StringValue instance, why not just send the string directly through a RemoteEvent?
What you need is a remote event to send the information from the text box text to the server to everyone can view it.
To have the text show up for everyone you can use a remote event and call that event from a local script.
edit: already said just ignore
thank you everyone, i have figured out what i needed to do and i got it working!!
Try this local script here, add this local script as a child of the text box. Make sure to put a RemoteEvent in Replicated Storage named “RemoteEvent”
local TextBox = script.Parent local RemoteEvent = game.ReplicatedStorage:WaitForChild('RemoteEvent') TextBox.FocusLost:Connect(function(enterPressed) if enterPressed then RemoteEvent:FireServer(TextBox.Text) end end)
Put the following server script into server script service:
local RemoteEvent = game.ReplicatedStorage:WaitForChild('RemoteEvent') RemoteEvent.OnServerEvent:Connect(function(Player,Text) print(Text) end)