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

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

Asked by 1 year ago

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)
0
You would have to look into RemoteEvents. You can search for a tutorial on YouTube bdam3000 125 — 1y

1 answer

Log in to vote
1
Answered by 1 year ago

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!

0
It works, though doesnt show for all other players. salaarkhan1 28 — 1y
0
Oh nvm, works. Just had to modify the normal script a bit salaarkhan1 28 — 1y
Ad

Answer this question