Textbox GUI help

Hello developers, I was wondering how I can make it so that when you enter something in on a textbox, and then presses the enter button, it appears on a text lable for everyone. Heres my script, but it only appears for one person (In a local script)


local SLT = script.Parent.SLT

SLT.Y7.Rounded.Enter.MouseButton1Click:Connect(function()
	script.Parent.Main.TT7.P1.Text = "Period 1: "..SLT.Y7.Rounded.P1E.Text
	script.Parent.Main.TT7.P2.Text = "Period 2: "..SLT.Y7.Rounded.P2E.Text
	script.Parent.Main.TT7.P3.Text = "Period 3: "..SLT.Y7.Rounded.P3E.Text
	script.Parent.Main.TT7.P4.Text = "Period 4: "..SLT.Y7.Rounded.P4E.Text
end)


-- Year 8 Time Table


SLT.Y8.Rounded.Enter.MouseButton1Click:Connect(function()
	script.Parent.Main.TT8.P1.Text = "Period 1: "..SLT.Y8.Rounded.P1E.Text
	script.Parent.Main.TT8.P2.Text = "Period 2: "..SLT.Y8.Rounded.P2E.Text
	script.Parent.Main.TT8.P3.Text = "Period 3: "..SLT.Y8.Rounded.P3E.Text
	script.Parent.Main.TT8.P4.Text = "Period 4: "..SLT.Y8.Rounded.P4E.Text
end)
-- Year 9 Time Table


SLT.Y9.Rounded.Enter.MouseButton1Click:Connect(function()
	script.Parent.Main.TT9.P1.Text = "Period 1: "..SLT.Y9.Rounded.P1E.Text
	script.Parent.Main.TT9.P2.Text = "Period 2: "..SLT.Y9.Rounded.P2E.Text
	script.Parent.Main.TT9.P3.Text = "Period 3: "..SLT.Y9.Rounded.P3E.Text
	script.Parent.Main.TT9.P4.Text = "Period 4: "..SLT.Y9.Rounded.P4E.Text
end)
-- Year 10 Time Table


SLT.Y10.Rounded.Enter.MouseButton1Click:Connect(function()
	script.Parent.Main.TT10.P1.Text = "Period 1: "..SLT.Y10.Rounded.P1E.Text
	script.Parent.Main.TT10.P2.Text = "Period 2: "..SLT.Y10.Rounded.P2E.Text
	script.Parent.Main.TT10.P3.Text = "Period 3: "..SLT.Y10.Rounded.P3E.Text
	script.Parent.Main.TT10.P4.Text = "Period 4: "..SLT.Y10.Rounded.P4E.Text
end)
-- Year 11 Time Table


SLT.Y11.Rounded.Enter.MouseButton1Click:Connect(function()
	script.Parent.Main.TT11.P1.Text = "Period 1: "..SLT.Y11.Rounded.P1E.Text
	script.Parent.Main.TT11.P2.Text = "Period 2: "..SLT.Y11.Rounded.P2E.Text
	script.Parent.Main.TT11.P3.Text = "Period 3: "..SLT.Y11.Rounded.P3E.Text
	script.Parent.Main.TT11.P4.Text = "Period 4: "..SLT.Y11.Rounded.P4E.Text
end)
-- Year 12 Time Table


SLT.SF.Rounded.Enter.MouseButton1Click:Connect(function()
	script.Parent.Main.TT12.P1.Text = "Period 1: "..SLT.SF.Rounded.P1E.Text
	script.Parent.Main.TT12.P2.Text = "Period 2: "..SLT.SF.Rounded.P2E.Text
	script.Parent.Main.TT12.P3.Text = "Period 3: "..SLT.SF.Rounded.P3E.Text
	script.Parent.Main.TT12.P4.Text = "Period 4: "..SLT.SF.Rounded.P4E.Text
end)

I just dont know how do to this in a script instead of a local script, so if anyone can help, it would be highly appriciated.

1 Like

Use A Remote Event And Fire A Message to the Server, And then Use FireAllClients() To Push it Back to All the Clients.

THIS IS AN EXAMPLE, EDIT ACCORDINGLY

Client Script

local Remote = game.ReplicatedStorage.RemoteEvent -- RemoteEvent Name Inside ReplicatedStorage
local EnterButton = -- Define Enter Button
local TextBox = -- Define TextBox
local DisplayingLabel = -- Define The TextLabel which Shows the Text Entered by Another Player

Remote.OnClientEvent:Connect(function(str)
    DisplayingLabel.Text = str
end)

EnterButton.Activated:Connect(function()
    Remote:FireServer(TextBox.Text) -- Fires A remote To the Server With the Text Entered in the TextBox
end)

ServerScript

local Remote = game.ReplicatedStorage.RemoteEvent -- RemoteEvent Name Inside ReplicatedStorage
Remote.OnServerEvent:Connect(function(sender,Str)
     Remote:FireAllClients(Str) -- Sends A Message to All Clients (players) With the String
end)
1 Like

I would’ve done this, however I have to have it for every text box and thats 4 per year group, and then 6 year groups, so I would need 24 remote events.

1 Like

@WheezWasTaken already gave the answer but I would like to expand on it so you don’t get banned

You must filter the string sent by the person typing so they cannot say explict things
Use TextService’s :FilterStringAsync()

2 Likes