Webhook scripting help with textboxes and sending webhooks

I’ve been trying to make it so that the textboxes text will go inside the webhook when I send it. However I’ve tried numerous things such as values as well. I cannot get it to work.

Basically you would enter the suspect’s name into the text box and then the web hook would grab the text boxes text and then send it.

E.G:

["description"] = "Username of officer: "..script.Parent.Parent.Parent.Parent.Parent.Name.." \n Username of offender: "..script.Parent.Textbox.Text.." ",
local HttpService = game:GetService("HttpService")
local webhook = "WEBHOOK"


function warning()
	
	
	local data = {
		["embeds"] = {
			{
				["color"] = 0000,
				["title"] = "Drivers License Warning issued",
				["description"] = "Username of officer: "..script.Parent.Parent.Parent.Parent.Parent.Name.." \n Username of offender: ".." ",
				["fields"] = {}
			}
		}
	}

	local newdata = HttpService:JSONEncode(data)
	HttpService:PostAsync(webhook, newdata)

	
end

script.Parent.MouseButton1Click:Connect(function()
	print("Hello")
	warning()
end)

2 Likes

The textbox’s text is only on the client; You would need to get the text from the client through a remote event.

1 Like

I’m assuming you use a text button to handle the start of the warning. Have the client handle that.

local remoteevent = --the path to the remote event

TextButton.MouseButton1Down:Connect(function()
    remoteevent:FireServer(TextBox.Text)
end)

Then handle the remote event on the server and add checks to make sure it is a valid request (ex: is an admin, is allowed to send request, etc)

So, I have converted the script to a local script now I presume I have to make a serverscript that receives the :FireServer

Yes, you would need a script that receives the Event.

Got any places where I can learn about basic remote event server and client operations?

You could use Roblox’s documentation on it.

1 Like

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