You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
Post to webhook -
What is the issue? Include screenshots / videos if possible!
Wont post to discord channel via webhook post - What solutions have you tried so far? Did you look for solutions on the Developer Hub?
No solutions, and there was no scripting error/warnings popping up.
Script:
function LogToDiscord(user, state)
local success = pcall(function()
local data = {
content = user.Name .. " has "..state.." the alarm!";
username = user.Name;
avatar_url = game.Players:GetUserThumbnailAsync(user.UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size100x100);
}
HttpService:PostAsync("https://discord.com/api/webhooks/xxxxxxxxxxxxxxxxx/dckVxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", HttpService:JSONEncode(data))
end)
end
AlarmsFolder.Remotes.RemoteFunction.OnServerInvoke = function(user,command)
if user then
local Check = GetPermission(user)
if Check then
if command and not cooldown then
cooldown = true
CooldownBool.Value = true
BeginAlarms()
LogToDiscord(user, "turned")
wait(cooldowntime)
CooldownBool.Value = false
cooldown = false
elseif not cooldown and not command then
cooldown = true
CooldownBool.Value = true
StopAlarms()
LogToDiscord(user, "disabled")
wait(cooldowntime)
CooldownBool.Value = false
cooldown = false
end
end
end
end