No text on the textlabel

I made a GUI you type a message and then click send. And it will be sent to a frame.
its actually working, i do see a frame but i don’t see any text on the frame.

my script on the button “Send”:

script.Parent.MouseButton1Click:Connect(function()
	local Message = game:GetService("ServerStorage"):WaitForChild("MessageFrame"):Clone()
	Message.TextLabel.Text = script.Parent.Parent.Message.Text 
	Message.Parent = script.Parent.Parent.Parent.Frame2
end)
2 Likes

what is Message.Text is it a TextLabel?

no, it is not a textlabel it is a textbox of course

Are you using a Local Script to Clone the message frame?

and you haven’t set the parent of the cloned message.

	local Message = game:GetService("ServerStorage"):WaitForChild("MessageFrame"):Clone()
    Message.Parent = -- Location here --

yes i did!

and tahts not even the problem!
the message frame is displayed but the text which is the message isn’t displayed.

oh!
do you mean first i have to set the parent and then the text?

is there any errors in Dev Console?

no, there is no error about it.

You can use Print() to check what parts of the script is working like Print("Frame Cloned!") and so on.

it is saying everything, cloning message set the parent, set text. and everyone of them.

The TextBox input is client-sided, you will need a local script to access the text.

but will other clients be able to see it?
or do I have to make a remote event?

if i do it in a local script, the frame does not appear making it worse than before!

We have no detailed information about how you’ve done replicating the text label. There might be several possible issues, but we can’t understand the exact issue you are facing. The possibilities are:

  • The script’s last parent looks like Workspace. I inferred that you access ServerStorage from a server-side script. However, while ServerStorage is accessible from the Workspace from your side, it won’t be replicated to other clients in the same server. Because script.Parent.Parent.Message location can never be approached by the server if it is not in Workspace. There is no clarification about where the message is typed.

  • If you want to get the text the client writes down in PlayerGui, you ought to use a RemoteEvent to replicate it to the server and sync with the other clients. However, this code snippet should be in a LocalScript. There is no way to grant the ServerStorage descendants, and you said in the first post that the frame appears without the text. Then, how is this possible with no error?

Consider providing the info about locations of UIs and the script in order to help fix your problem.

my script is not even inside the workspace.

Did you set the Adornee property of the SurfaceGui anywhere located in Workspace? If it is not Workspace, are you rendering the text label in PlayerGui? How’d you get ServerStorage if it is not a Script? Are you sure you don’t get any errors printed on the output?

Other things to glance at:

  • TextTransparency, Visible, Size, Position, Zindex properties of the TextLabel
  • The Explorer menu right after the frame replicates if the text label as well is inherited.
  • The text if it is not empty nor containing whitespaces.

Server scripts should not be used to connect to client-based events. TextBox input is client-sided so it will not get seen by the server. Additionally it seems like you’re just adding something to a Gui so you shouldn’t even be using the server at all here. Use a LocalScript and pick a different parent other than ServerStorage to store the template frame.

1 Like

and that was why it got worswew with local scripts!

but I want everyone to see it. should I make a remote event?