UserData variable problems

Hi! I am trying to make an Application Center System. It is working very well except I am having a slight problem that I just can’t manage to get past! I keep on getting the following error; https://gyazo.com/5620360b598f8a177936eb90243714aa?token=8e67d3ea68e28e17b14f888c099a9dcb

Now you may be thinking, “Oh that’s simple. Just do this and that”, but it’s not here’s why.

The below is a LocalScript, it fires an event to a Server Script which is on the bottom of this help topic.

--Lines 30-34, LocalScript.
local Q1AnswerBox = script.Parent.Q1.q1a
local Q2AnswerBox = script.Parent.Q2.q1a
local Q3AnswerBox = script.Parent.Q3.q1a
local Q4AnswerBox = script.Parent.Q4.q1a
local discordbox = script.Parent.Parent.pinfo.emorph

Below is lines 101-102

local submitevent = game.ReplicatedStorage.level1submit
submitevent:FireServer(Q1AnswerBox.Text, Q2AnswerBox.Text, Q3AnswerBox.Text,  
Q4AnswerBox.Text, discordbox.Text)

Below is a server script which receives the Event. lines 65-112

game.ReplicatedStorage.level1submit.OnServerEvent:Connect(function(Q1AnswerBox, Q2AnswerBox, Q3AnswerBox, Q4AnswerBox, discordbox)



print("Received")
print(discordbox)
print(Q1AnswerBox)
print(Q2AnswerBox)
print(Q3AnswerBox)
print(Q4AnswerBox)

local HttpService = game:GetService("HttpService")

local ui = game.StarterGui.AppCenter.mainBG

local id = math.random(11111,99999)

local webhook = "censored"
	local data = {
		["embeds"] = {{
    		["title"] = "A new form has been submitted.",
			["description"] = "**Discord Name/Tag; ** " ..discordbox.."\n Application ID; "..id.."\n Type; Level 1",
			["color"] = 184,
			["fields"] = {
				{
					["name"] = "**Q1:** Why do you want to be L1?",
						["value"] = ""..Q1AnswerBox
					},
					{
						["name"] = "**Q2:** How can you benefit the Foundation?",
						["value"] = ""..Q2AnswerBox
					},
					{
						["name"] = "**Q3:** Which departments would you like to join if you pass this application?",
						["value"] = ""..Q3AnswerBox
					},
					{
						["name"] = "**Q4:** What makes an SCP obtain the classification of Euclid?",
						["value"] = ""..Q4AnswerBox
					}
			}
			
			}}
	}
	print("sent to discord")
	HttpService:PostAsync(webhook, HttpService:JSONEncode(data))
		
		end)

So, I guess my question is, how is it saying it’s the Q1AnswerBox is userdata?

You’re referencing an object, not the object’s text property.

EDIT: I recommend referencing the text before you fire the server.

When I fire the event, I fire Q1AnswerBox.Text

When your receiving values fired to the server, you should list the player first, since the first variable is the player that fired to the server.

2 Likes

That makes sense, let me try that!

it worked! Thank you for your response. :slight_smile: