Just as the Title suggests. I have a TextBox where you can write your answer to a application question and when you hit next the LocalScript Fires a ServerEvent that gets picked up by a Server Script that creates a StringValue answer where the Answer from the TextBox should be the value but it just stays empty and I have no idea how to fix this.
We can’t help you if you don’t show us your script.
Here’s the LocalScript:
wait(5)
local folder = game.ReplicatedStorage.Alpha
local Question = 1
if Question == 1 then
script.Parent.Question.Text = folder.Q1.Question.Value
end
game.ReplicatedStorage.Application.Value = “Alpha”
script.Parent.Proceed.Activated:Connect(function()
if Question == 1 then
Question = Question + 1
print(script.Parent.TextBox.Text)
game.ReplicatedStorage.AlphaUpdate:FireServer()
wait(1)
script.Parent.TextBox.Text = ""
script.Parent.Question.Text = folder.Q2.Question.Value
elseif Question == 2 then
Question = Question + 1
game.ReplicatedStorage.AlphaUpdate:FireServer()
wait(1)
script.Parent.TextBox.Text = ""
script.Parent.Question.Text = folder.Q3.Question.Value
elseif Question == 3 then
Question = Question + 1
game.ReplicatedStorage.AlphaUpdate:FireServer()
script.Parent.TextBox.Text = ""
script.Parent.Question.Text = folder.Q4.Question.Value
elseif Question == 4 then
Question = Question + 1
game.ReplicatedStorage.AlphaUpdate:FireServer()
script.Parent.TextBox.Text = ""
script.Parent.Question.Text = folder.Q5.Question.Value
elseif Question == 5 then
Question = Question + 1
game.ReplicatedStorage.AlphaUpdate:FireServer()
script.Parent.TextBox.Text = ""
script.Parent.Question.Text = folder.Q6.Question.Value
elseif Question == 6 then
Question = Question + 1
game.ReplicatedStorage.AlphaUpdate:FireServer()
script.Parent.TextBox.Text = ""
script.Parent.Question.Text = "You're done."
game.ReplicatedStorage.Send:FireServer()
wait(1)
game.Players.LocalPlayer:Kick("Finished, Wait for a response in the Communications Server.")
end
end)
AlphaUpdate Script:
local module = require(script.ModuleScript)
local folder = game.ReplicatedStorage.Alpha
local Question = 1
game.ReplicatedStorage.AlphaUpdate.OnServerEvent:Connect(function(Player)
if Question == 1 then
module.update(folder.Q1, Player.PlayerGui.ApplicationMain.Main.Applications.Alpha.TextBox.Text)
print(Player.PlayerGui.ApplicationMain.Main.Applications.Alpha.TextBox.Text)
Question = Question + 1
elseif Question == 2 then
module.update(folder.Q2, Player.PlayerGui.ApplicationMain.Main.Applications.Alpha.TextBox.Text)
Question = Question + 1
elseif Question == 3 then
module.update(folder.Q3, Player.PlayerGui.ApplicationMain.Main.Applications.Alpha.TextBox.Text)
Question = Question + 1
elseif Question == 4 then
module.update(folder.Q4, Player.PlayerGui.ApplicationMain.Main.Applications.Alpha.TextBox.Text)
Question = Question + 1
elseif Question == 5 then
module.update(folder.Q5, Player.PlayerGui.ApplicationMain.Main.Applications.Alpha.TextBox.Text)
Question = Question + 1
elseif Question == 6 then
module.update(folder.Q6, Player.PlayerGui.ApplicationMain.Main.Applications.Alpha.TextBox.Text)
Question = Question + 1
end
end)
ModuleScript:
local alpha = {}
function alpha.update(Parent, Value)
local Answer = Instance.new(“StringValue”)
Answer.Name = “Answer”
Answer:Clone()
Answer.Parent = Parent
Answer.Value = Value
end
return alpha
Does the script not run at all, and if it runs, which lines includes setting the value?
All Scripts run the script setting the value is the Server Script when a event is fired from the localscript.
This here is the server script
local module = require(script.ModuleScript)
local folder = game.ReplicatedStorage.Alpha
local Question = 1
game.ReplicatedStorage.AlphaUpdate.OnServerEvent:Connect(function(Player)
if Question == 1 then
module.update(folder.Q1, Player.PlayerGui.ApplicationMain.Main.Applications.Alpha.TextBox.Text)
print(Player.PlayerGui.ApplicationMain.Main.Applications.Alpha.TextBox.Text)
Question = Question + 1
elseif Question == 2 then
module.update(folder.Q2, Player.PlayerGui.ApplicationMain.Main.Applications.Alpha.TextBox.Text)
Question = Question + 1
elseif Question == 3 then
module.update(folder.Q3, Player.PlayerGui.ApplicationMain.Main.Applications.Alpha.TextBox.Text)
Question = Question + 1
elseif Question == 4 then
module.update(folder.Q4, Player.PlayerGui.ApplicationMain.Main.Applications.Alpha.TextBox.Text)
Question = Question + 1
elseif Question == 5 then
module.update(folder.Q5, Player.PlayerGui.ApplicationMain.Main.Applications.Alpha.TextBox.Text)
Question = Question + 1
elseif Question == 6 then
module.update(folder.Q6, Player.PlayerGui.ApplicationMain.Main.Applications.Alpha.TextBox.Text)
Question = Question + 1
end
end)
Hmm, I can’t understand the script much (you can probably organise it better), but could it be because your creating a new stringvalue each time?
No, the StringValue doesn’t wanna have the value of the TextBox.Text. If I set the value from the StringValue with the localscript it works but wont get picked up by a server script and now its the other way around.
Are you deleting the StringValues though? If I’m not wrong you might have alot of StringValues, breaking the system.
If a question is answered and a player hites the Proceed Button a stringvalue thats value is supposed to contain the answer (TextBox.Text) gets cloned into the Q1 folder and when the next one has been answered it gets cloned into the Q2 folder so when every question has been answered every Q folder will have their answer stringvalue inside of it
Did you test if the module script is working? If it works, try printing also the value of the StringValue.
The ModuleScript does work and the function it contains properly clones the new string value instance into the Q folders. I tried printing but it came back as nothing
Try also printing “Value”, the parameter. It might be the problem.
Tried that, it unfortunately returns nothing. The server script probably has a problem reading the TextBox.Text
Yes, I guess the last thing to do is check what the client is sending.
Where are you passing through the textbox text to the server? The parameter in FireServer() is empty.
Oh yeah youre right, I added the textbox text value to the FireServer() function and added a (player, text) to the connect function in the server script. Now the TextBox Text value gets to the server script and to the discord webhook. Thanks for the tip.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.