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```