Text box - text lable help!

Hello developers, I am trying to make a gui that when you enter something into a text box, it shows up on a text lable, here is the script i have!

But it comes up with an error

Server Script


local Remote = game.ReplicatedStorage.TimeTable

Remote.OnServerEvent:Connect(function(P17,P27,P37,P47,Year7,P18,P28,P38,P48,Year8,P19,P29,P39,P49,Year9,P110,P210,P310,P410,Year10,P111,P211,P311,P411,Year11,P112,P212,P312,P412,SixthForm)
    Remote:FireAllClients(P17,P27,P37,P47,Year7,P18,P28,P38,P48,Year8,P19,P29,P39,P49,Year9,P110,P210,P310,P410,Year10,P111,P211,P311,P411,Year11,P112,P212,P312,P412,SixthForm)
end)

Local Script

local SLT = script.Parent.SLT

SLT.Y7.Rounded.Enter.MouseButton1Click:Connect(function()
    local Year7 = "Year7"
    local P17 = SLT.Y7.Rounded.P1E
    local P27 = SLT.Y7.Rounded.P2E
    local P37 = SLT.Y7.Rounded.P3E
    local P47 = SLT.Y7.Rounded.P4E
    remote:FireServer(P17,P27,P37,P47,Year7)
end)

SLT.Y8.Rounded.Enter.MouseButton1Click:Connect(function()
    local Year8 = "Year8"
    local P18 = SLT.Y8.Rounded.P1E
    local P28 = SLT.Y8.Rounded.P2E
    local P38 = SLT.Y8.Rounded.P3E
    local P48 = SLT.Y8.Rounded.P4E
    remote:FireServer(P18,P28,P38,P48,Year8)
end)

SLT.Y9.Rounded.Enter.MouseButton1Click:Connect(function()
    local Year9 = "Year9"
    local P19 = SLT.Y9.Rounded.P1E
    local P29 = SLT.Y9.Rounded.P2E
    local P39 = SLT.Y9.Rounded.P3E
    local P49 = SLT.Y9.Rounded.P4E
    remote:FireServer(P19,P29,P39,P49,Year9)
end)

SLT.Y10.Rounded.Enter.MouseButton1Click:Connect(function()
    local Year10 = "Year10"
    local P110 = SLT.Y10.Rounded.P1E
    local P210 = SLT.Y10.Rounded.P2E
    local P310 = SLT.Y10.Rounded.P3E
    local P410 = SLT.Y10.Rounded.P4E
    remote:FireServer(P110,P210,P310,P410,Year10)
end)

SLT.Y11.Rounded.Enter.MouseButton1Click:Connect(function()
    local Year11 = "Year11"
    local P111 = SLT.Y11.Rounded.P1E
    local P211 = SLT.Y11.Rounded.P2E
    local P311 = SLT.Y11.Rounded.P3E
    local P411 = SLT.Y11.Rounded.P4E
    remote:FireServer(P111,P211,P311,P411,Year11)
end)

SLT.SF.Rounded.Enter.MouseButton1Click:Connect(function()
    local SixthForm = "SixthForm"
    local P112 = SLT.SF.Rounded.P1E
    local P212 = SLT.SF.Rounded.P2E
    local P312 = SLT.SF.Rounded.P3E
    local P412 = SLT.SF.Rounded.P4E
    remote:FireServer(P112,P212,P312,P412,SixthForm)
end)

local Y7 = script.Parent.Main.TT7
local Y8 = script.Parent.Main.TT8
local Y9 = script.Parent.Main.TT9
local Y10 = script.Parent.Main.TT10
local Y11 = script.Parent.Main.TT11
local SF = script.Parent.Main.TT7

remote.OnClientEvent:Connect(function(P17,P27,P37,P47,Year7,P18,P28,P38,P48,Year8,P19,P29,P39,P49,Year9,P110,P210,P310,P410,Year10,P111,P211,P311,P411,Year11,P112,P212,P312,P412,SixthForm)
    Y7.P1.Text = "Period 1: " ..P17.Text
    Y7.P2.Text = "Period 2: "..P27.Text
    Y7.P3.Text = "Period 3: "..P37.Text
    Y7.P4.Text = "Period 4: "..P47.Text

    Y8.P1.Text = "Period 1: "..P18.Text
    Y8.P2.Text = "Period 2: "..P28.Text
    Y8.P3.Text = "Period 3: "..P38.Text
    Y8.P4.Text = "Period 4: "..P48.Text

    Y9.P1.Text = "Period 1: "..P19.Text
    Y9.P2.Text = "Period 2: "..P29.Text
    Y9.P3.Text = "Period 3: "..P39.Text
    Y9.P4.Text = "Period 4: "..P49.Text

    Y10.P1.Text = "Period 1: "..P110.Text
    Y10.P2.Text = "Period 2: "..P210.Text
    Y10.P3.Text = "Period 3: "..P310.Text
    Y10.P4.Text = "Period 4: "..P410.Text

    Y11.P1.Text = "Period 1: "..P111.Text
    Y11.P2.Text = "Period 2: "..P211.Text
    Y11.P3.Text = "Period 3: "..P311.Text
    Y11.P4.Text = "Period 4: "..P411.Text

    SF.P1.Text = "Period 1: "..P112.Text
    SF.P2.Text = "Period 2: "..P212.Text
    SF.P3.Text = "Period 3: "..P312.Text
    SF.P4.Text = "Period 4: "..P412.Text

end)

And the error I get is

Text is not a valid member of Player "Players.Bear23913" 

If anyone knows how I can fix this, please do let me know!

There is a child in a player (Bear23913) called PlayerGui. That’s where the client Ui’s are. I don’t see Players.Bear23913 anywhere in the script. What line is it in?

Its not in the script, and my username is Bear23913 thats why it said that on the error

Because of the way remote events work, the code thinks P17 is the player who fired the event

local Remote = game.ReplicatedStorage.TimeTable
Remote.OnServerEvent:Connect(function(Player,P17,P27,P37,P47,Year7,P18,P28,P38,P48,Year8,P19,P29,P39,P49,Year9,P110,P210,P310,P410,Year10,P111,P211,P311,P411,Year11,P112,P212,P312,P412,SixthForm)
    Remote:FireAllClients(P17,P27,P37,P47,Year7,P18,P28,P38,P48,Year8,P19,P29,P39,P49,Year9,P110,P210,P310,P410,Year10,P111,P211,P311,P411,Year11,P112,P212,P312,P412,SixthForm)
end)

The above code should fix your problem

1 Like

That fixes that issue, however, I get a new one "Players.Bear23913.PlayerGui.ScreenGui.LocalScript:187: attempt to index nil with ‘Text’ "

I managed to fix the issue, by creating separate remote events for each Year Group, thank you for your help!