You cannot send webhooks from the client. First make it a server script.
local http = game:GetService("HttpService")
game.Players.PlayerAdded:Connect(function(newPlayer)
if newPlayer:IsInGroup(4199749) then
local data = os.date("!*t")
-- Your data
end)
end)
local httpSer = game:GetService("HttpService")
local runSer = game:GetService("RunService")
game.Players.PlayerAdded:Connect(function(newPlr)
if newPlr:IsInGroup(4199740) and not runSer:IsStudio() then
local date = os.date("!*t")
local data = {
["content"] = newPlr.Name.. " joined on ".. date.month.. "/".. date.day.."/".. date.year
local httpData = httpSer:JSONEncode(Data)
httpSer:PostAsync("Webhook goes here", httpData)
}
end
end)
Let me know if this helps. Need help, let me know. Thanks, WE
local Http = game:GetService("HttpService")
game:GetService("Players").PlayerAdded:Connect(function(newPlr)
if newPlr:IsInGroup(4199740) then
local Date = os.date(" joined on %x",os.time())
local data = {["content"] = newPlr.Name .. Date}
Http:PostAsync(URL,Http:JSONEncode(data))
-- More code
end
end)
This webhook script worked for me (inside of a ModuleScript)
local url = "https://discord.com/api/webhooks/#############/###########"
local HTTP = game:GetService("HttpService")
return function(message)
data = {
content = message
}
HTTP:PostAsync(url, HTTP:JSONEncode(data))
end
I know that this works, so if it doesn’t work, then it must be an issue with the player joining.