So we have a Voting & Ceremony center but our gui wont send the messages to the discord webhook properly, can someone help me?

script.Parent.MouseButton1Click:connect(function()
	local player = script.Parent.Parent.Parent.Parent.Parent
	local playername = player.Name
	local usr = game.Players[playername].PlayerGui.VotingGUI.Frame.userTXT.Text
	local reason = game.Players[playername].PlayerGui.VotingGUI.Frame.reasonTXT.Text
	
	local      Http      =      game:GetService("HttpService")
	local      Website   =      "https://www.sparksammy.com/discord-redirect"
	local      File      =      "/index.php?"
	local      Webhook   =      "https://discordapp.com/api/webhooks/BLURRED" 

	print(messageToDisc)
	local Info = {
	      username = playername,
	      content = " I voted for " .. usr .. " because: " .. reason ,
   	   --// More at https://discordapp.com/developers/docs/resources/webhook
	}
	
	Http:GetAsync(Website .. File .. "Content=" .. Http:JSONEncode(Info) .. "&Discord=" .. Webhook)

	
	game.Players[playername].PlayerGui.VotingGUI.Enabled = false
end)

5 comments

0

Can you confirm that your redirect is working properly for other messages sent to the discord? In addition you may be having an issue with using GetAsync instead of PostAsync

0

I assume the problem is because you're using a serverscript inside a gui (or you're using localscript and trying to use HttpService)

0

Send the HttpRequest on the server, fire a remote from the client with the information such as who they voted for and why.

0

To handle debouncing if people spam the remote, add each player into a table (make sure to add players when they join) and give each one a boolean, when they fire the event check their boolean in the table with the index you gave them and set it to the opposite of itself and then call a yield, then set it back to what it was originally.

0

That's true, I am using a serverscript inside a gui (its not a localscript)