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

How do I make text input from a textbox visible to all players?

I am working on a story game where you can create a room with a modifiable name. Text input will not show for all players and I have searched this up a lot of times, though nothing helped. Script:

script.Parent.MouseButton1Click:Connect(function()
	local room = script.Parent.Parent.Parent.ServersFrame.Room
	local textbox = script.Parent.Parent.Textbox
	if room.Visible == false then
		room.Visible = true
		room.TextLabel.Text = textbox.ContentText


	end
end)

1 comment

0

You would have to look into RemoteEvents. You can search for a tutorial on YouTube

1 answer

✓ Accepted answer

Use RemoteEvents. To make a remote event, go to ReplicatedStorage, click plus and choose "RemoteEvent". After that change the name to "TextBoxText". Then, in your button local script, you must fire the remote event and send the text to the server by:

script.Parent.MouseButton1Click:Connect(function()
	local room = script.Parent.Parent.Parent.ServersFrame.Room
	local textbox = script.Parent.Parent.Textbox
	if room.Visible == false then
		game.ReplicatedStorage.TextBoxText:FireServer(textbox.ContentText, true)
	end
end)

Then, you will create a normal script (not local script) inside your TextLabel and that's where the remote event will be sent. To get the ContentText from the client you must do:

game.ReplicatedStorage.TextBoxText.OnServerEvent:Connect(function(player, contentText, showTextLabel)
	script.Parent.Visible = showTextLabel
	script.Parent.Text = contentText
end)

And you're done!

2 comments

0

It works, though doesnt show for all other players.

0

Oh nvm, works. Just had to modify the normal script a bit

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