Webhook Request fails when reliant on event

Hello devforum,

I’m currently working on webhook reliant resources to use later in other games (this was in my previous post)

The webhook code works as intended, but when I make it reliant on an event to be sent then it just stops working completely.

Here is my server script:

local HTTP = game:GetService("HttpService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Event = ReplicatedStorage.InfoPass

local ProxyURL = "https://discord.com/api/webhooks/xxx/xxx"

Event.OnServerEvent:Connect(function()
local HookData = {
		["content"] = "hello",
		["embeds"] = {{
			["title"] = "I hate this so much",
			["description"] = "aaaaaaaaaaaaaa",
			["type"] = "rich",
			["fields"] = {
				{
					["name"] = "Field Tests",
					["value"] = "ahahahaha ",
					["inline"] = true,
				}
			}
		}}
	}

local HAPPY = HTTP:JSONEncode(HookData)
HTTP:PostAsync(ProxyURL, HAPPY)
end)

And here is my Localscript:

local RepStore = game:GetService("ReplicatedStorage")
local Event = RepStore:WaitForChild("InfoPass")
local proxi = script.Parent.ProximityPrompt

proxi.Triggered:Connect(function()
	Event:FireServer()
end)

If anyone has a possible solution, please reply.

1 Like

LocalScripts do not run in Workspace. Perhaps that’s the problem?

I don’t think so.
I’ve just moved the localscript to ServerScriptService and edited the script to find the proximityprompt in workspace.
I’ve also added print("hello") into the localscript’s function, but it still doesn’t work

I think the function for some reason just isn’t being run, and I have no idea why.

LocalScripts cannot run in ServerScriptService
As the name suggests, Server Scripts only.

Try chucking the LocalScript into StarterPlayerScripts.

Locations where they can run: