Admin Command Logger Only works in studio

My code is for Adonis Loader(Adonis Admin Commands) as a server plugin, but for some reason it will not play in the actual game but only in studio. Why is this?

service = nil

-- Services
local HttpService = game:GetService("HttpService")

-- Variables
local Settings = {
	Webhook = "Not showing you my webhook/Discord Webhook"; -- Replace with your webhook link. (MAKE SURE YOU KEEP THE QUOTES)
	RunForGuests = false; -- Set to true if you want guests (players without admin) commands to be logged.
	Ignore = {}; -- Commands you want ignored. Example: {":fly", ":speed"}
}

local function FindInArray(arr, obj)
	for i = 1, #arr do
		if arr[i] == obj then
			return i
		end
	end
	return nil
end

-- Module
return function()
	service.Events.CommandRan:Connect(function(plr, data)
		local msg = data.Message;
		local cmd = data.Matched;
		local args = data.Args;

		if FindInArray(Settings.Ignore, string.lower(cmd)) then
			return
		end

		local pLevel = data.PlayerData.Level
		local Level = server.Admin.LevelToListName(pLevel)
		if Level or (not Level and Settings.RunForGuests) then
			HttpService:PostAsync(Settings.Webhook, HttpService:JSONEncode({
				embeds = {{
					title = "Command Log";
					description = "\n**Player:** " .. plr.Name .. "\n**Level:** " .. (Level or "Guest") .. "\n**Command:** " .. msg;
					color = 245451;
				}}
			}))
		end
	end)
end```

Make sure you are using a proxy. Ex: https://webhook.lewistehminerz.dev/

2 Likes

Okay, I’m testing it now.
https://hooks.hyra.io/api/webhooks/xxxxxx/xxxxxxx
I’m using this, as lewis had anti-abuse engaged.

1 Like

Seemed to work, thank you a ton! This is really important for me.

Ah, didn’t know that. May have to switch my webhook proxy soon lol

Yeah, I tried it, nothing worked. 10 Seconds later it had anti-abuse engaged. Seems a little odd.

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