Help, Textbox not working properly

My tag is iSt_xrm#7250 Please add me so I can screenshare and explain in detail the problem.

Otherwise here it is,
I am doing an app center and I am using a loop for to check on the questions elements, here it is,

--//Credits to iSt_xrm\\--


script.Parent.Submit.Activated:Connect(function()
wait(1)
--//Varibales\\--
local Event = game.ReplicatedStorage.Webhook
local Submit = script.Parent.Submit
local Children = script.Parent.Frame:GetChildren()
local plr = game.Players.LocalPlayer
local AnswerQuery
	
	table.sort(Children, function(a, b)
   	 return string.lower(a.Name) < string.lower(b.Name) 
	end)
wait(1)
	for i, Element in ipairs(Children) do 
		print(i.."|"..Element.Name)
			if Element:IsA("ImageLabel") then
				if Element.Answer.Text ~= "" then
				print("txt"..Element.Name)
				AnswerQuery = "**"..Element.Name.."**\n"..Element.Answer.Text.."\n\n"
				else
				warn(Element.Name)
				Submit.Text = "MISSING ANSWER(S)"
				wait(5)
				Submit.Text ="APPLY"
				return
				end
			end
	end
	
	Event:FireServer(AnswerQuery, plr.Type)

	script.Parent.Parent.Questions.Visible = false
	script.Parent.Parent.Sending.Visible = true
----
end)

basically when the textbox has a text it should redifine answerqueryh and fire the server, but instead, it just returns and says thereā€™s no text when there is, help meā€¦

2 Likes

You should put this line inside the for loop:

1 Like

I was going to do that but if I do then the query will be sent multiple times and will mean that the server will generate more messages when I just need 1 message, even though it dont really amtters because the return object is inside the loop not outsideā€¦

Are there any errors? Does the code run all the way through?

"**"..Element.Name.."**\n"..Element.Answer.Text.."\n\n"

I dont know, but that part should be in brackets?

I will place it in brackets but the thing is that when the text is on the textbox and I click the submit button, it says no text is there when there actually is one.

May I see your server script where the remote runs?

--//Credits to iSt_xrm\\--

--//Varibales\\--
local Event = game.ReplicatedStorage.Manager

Event.OnServerEvent:Connect(function(plr, gui, Type) 
	local BackgroundQuestion = Color3.new(204, 204, 204)
	local QuestionColor = Color3.new(76, 186, 229)
	local Children = script[Type]:GetChildren()
	
	table.sort(Children, function(a, b)
   	 return string.lower(a.Name) < string.lower(b.Name) 
	end)
	
	gui.Frame.CanvasSize = UDim2.new(0,0,#Children*0.5,0)
	for Type, Questions in ipairs(Children) do 
				local P = script.Question:Clone()
				P.Parent = gui.Frame
				P.Text = Questions.Name
				P.Name = "Question"
				local A = script.Answer:Clone()
				A.Parent = gui.Frame
				A.Name = "Answers_"..Questions.Name
	end		
	local ch = Instance.new("StringValue")
	ch.Name = "Type"
	ch.Value = Type
	ch.Parent= plr
end)


Ahh, now I see the problem:

the ā€œguiā€ variable is the problem.

You are trying to index a string value with no parenting whatsoever

in brief terms:

gui = AnswerQuery = "**"..Element.Name.."**\n"..Element.Answer.Text.."\n\n"

in the server script you did:

gui.Frame, which is not going to work

1 Like

The gui is part of the player guiā€¦

That gui variable is passed on by the remote function:

Event:FireServer(AnswerQuery, plr.Type)

and then passed on to the server

Event.OnServerEvent:Connect(function(plr, gui(AnswerQuery), Type(plr.Type))
1 Like

Oh thanks for that one , did not notice that mistake, will fix it like right now.