Repl.it returns undifined even thought args were given properly

Short explaination:
I’m trying to make a roblox-to-discord verification system, but this thing is in my way and I’ve tried many other topics and even went as far as re-writing the entire script, but all for no worth. It still seems to not work, I know there’s some issues, but I don’t know which are the issues. Helping hand would be nice.

Replit Code

app.post("/Verification?", (req, res) => {
     res.send(req.params.user + " " + req.params.name) // body
})

Response from replit website when command is sent

undefined undefined  -  Server - Script:16

SCRIPT: Game.Workspace

local Https = game:GetService("HttpService")
local rem = game.ReplicatedStorage.RemoteEvent
local URL = "Sike no."

game.Players.PlayerAdded:Connect(function(player)
	
	local clone = game.ServerStorage.ScreenGui:Clone()
	clone.Parent = game.Players[player.Name].PlayerGui
	clone.Name = "VerificationUI"
	
	rem.OnServerEvent:Connect(function(player, data)
		
		local encodedData = Https:JSONEncode({user = data, name = player.Name})
		local response = Https:PostAsync(URL, encodedData, Enum.HttpContentType.ApplicationUrlEncoded, false)
		print(response)
	end)	
end)

(The variable “Data” is is the thing that a player typed in the textbot, that works, I’ve tested it. But from the HTTPS request, it sends it to the replit website but it grabs it as “undifned.” which I don’t understand.)

1 Like

Nevermind, I’ve figured it out, if you wanted to reply, I deeply thank you but I’ve found out that in

Https:PostAsync(URL, encodedData, Enum.HttpContentType.ApplicationUrlEncoded, false)

that the ApplicationUrlEncoded means that it’ll send it to the website via search bar for example, so I changed it into Enum.HttpContentType.ApplicationJson and it worked.

You might want to remove the url from the script in the post

1 Like

you might want to move the url since other people may already copied your link.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.