So I have a system where players can send suggestions to a discord bot in my server. But the text does not seem to be working... Here is my local script in the GUI button:

script.Parent.MouseButton1Click:Connect(function()
	local plr = game.Players.LocalPlayer
	local msg = script.Parent.Parent.TextBox
	if msg.Text == "" or msg.Text == " " then
		script.Parent.Text = "Your suggestion cannot be empty!"
		wait(3)
		script.Parent.Text = "Submit"
	else
		game.ReplicatedStorage:WaitForChild("Remotes"):WaitForChild("SendSuggestion"):FireServer(plr)
		script.Parent.Text = "Suggestion sent successfully!"
		wait(3)
		script.Parent.Text = "Submit"
	end
end)

And here is the server script in ServerScriptService:

game.ReplicatedStorage:WaitForChild("Remotes"):WaitForChild("SendSuggestion").OnServerEvent:Connect(function(plr)
	local msg = plr.PlayerGui.Suggest.Suggest.TextBox
	local http = game:GetService("HttpService")
	local Data = {
		["content"] = plr.Name.." suggested: "..tostring(msg.Text)
	}
	
	Data = http:JSONEncode(Data)
	
	http:PostAsync("pro tip don't post your webhook url publicly", Data)
end)

And all it sends is: PrismaticFruits suggested: and nothing else. I even tried removing the name part of it to just tostring(msg.Text) and that is when the error occurred. I also tried using msg as an argument but it still didn't work, that errored: Text is not a valid member of player.. So could someone point out what is wrong?

7 comments

3

You're trying to get the text of a textbox on the server. You need to do it on the client and send it to the server via remotes. Also don't post your webhook urls publicly

0

i Tried sending an argument to the server of the text but it still didn't work.

0

^ What error does it give? What happens?

0

Nothing happens. It sends the message to discord, but as nothing. It just says the bot then no message.

0

If you print content before posting it, does it print what it's supposed to? Btw, if you're using discord directly, you might want to use a proxy, like https://discord.osyr.is

0

Nvm, osyris isnt maintaining that anymore, try finding another one

0

It prints nothing.