Key 'Text' not found in class 'Frame', I am not trying to select the frame

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to have a variable set from a textbox’s contents, from two text boxes.
  2. What is the issue? Include screenshots / videos if possible!
    I use local Username = (script.Parent.Parent.username.Text) but still get an error
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I have tried many solutions, and many tries at defining the textbox’s location.
function leftClick()

	local Player = script.Parent.Parent.Parent.Parent
	local name = (Player.Name)
	local ReplicatedStorage = game:GetService("ReplicatedStorage")
	local reportmusic = ReplicatedStorage:WaitForChild("reportmusic")
	local reason = (script.Parent.Parent.Text)
	local Username = (script.Parent.Parent.username.Text)

	reportmusic:FireServer(reason, Username)
end
script.Parent.MouseButton1Click:Connect(leftClick)

image

script.Parent is the TextButton.

script.Parent.Parent is the Frame.

script.Parent.Parent.Text is trying to do Frame.Text, which is a problem because Frames don’t have Text.

Maybe you just wanted script.Parent.Text?

Wouldn’t that be the text button? And I also have two text boxes, so how Would I differentiate the two?

@nicemike40 is right in saying that the issue is with the reason variable, but, as you said, the proposed solution would not work since script.Parent.Text is referring to a TextButton, not the “reason” TextBox.

To differentiate between the two TextBoxes, just use their names. “username” would be referred to as: script.Parent.Parent.username, and “reason” would be script.Parent.Parent.reason

So, changing the reason variable to script.Parent.Parent.reason.Text should fix the issue.

1 Like