I’m making a VMS board for a roadwork game, and the player is able to enter the text for each line of the board, through a UI. But when I go to edit the line, the text on the part disappears, and it’s meant to display the text in the TextLabel: https://i.gyazo.com/8c2e26d5cb1e5fac180b769b50a6abb0.mp4
-- This is in my LocalScript
TextFrame.Line1:GetPropertyChangedSignal("Text"):Connect(function(text)
Event:FireServer(TextFrame.Line1, physicalFrame.Line1)
end)
TextFrame.Line2:GetPropertyChangedSignal("Text"):Connect(function(text)
Event:FireServer(TextFrame.Line3, physicalFrame.Line2)
end)
TextFrame.Line3:GetPropertyChangedSignal("Text"):Connect(function(text)
Event:FireServer(TextFrame.Line3, physicalFrame.Line3)
end)
TextFrame.Line4:GetPropertyChangedSignal("Text"):Connect(function(text)
Event:FireServer(TextFrame.Line4, physicalFrame.Line4)
end)
-- This is in my Script
Event.OnServerEvent:Connect(function(player, uiLabel, physicalLabel)
physicalLabel.Text = uiLabel.Text
end)
These are the bits of code I presume are causing the issue, as the majority of the rest is just variable assignments.
I’m using GPCS to detect when the text is changed, and a RemoteEvent to update the physical sign.
Why are u sending the whole Instance through Fire, just send over the data you need, if for this case you need the text that you typed and the and Label you wanna change then send those. Also Check the text value before you send it
ui label only exists locally
the server script cant find it cause it doesnt exist serverside
pass the text through, not the instance, and set the physical text equal to the string/text you’ve passed through
yeah server/client stuff can be annoying, try always assuming that’s the issue when dealing with remote events/functions
Half correct. You have the general idea but not the actual problem. The Gui is in StarterGui so the server handles replication of the Gui to clients when they spawn. Since the server is the one making the copy the instances also exist on the server (and therefore references are non-nil).
What’s not replicating is the Text property. Clients typing into a TextBox changes the Text property only locally. These changes do not replicate to the server therefore when the client passes the TextBoxes to the server it sees a blank Text property (the same as before the Gui was cloned).
If the label only existed locally the server would get an error trying to work with the argument because it would be trying to read indices (properties and/or children) from nil which has no members.
OP needs to pass the Text property of the TextBoxes through to the RemoteEvents. The remote will create a copy of the string which the server will receive and that can be used instead.