Im trying to make that everytime someone joins i will get message in discord by webhook
1 Like
Welcome to the CookieTech forums!
There is a way to send a webhook when someone joins, and I have a whole model for it, it’s called “ezLOG”. Here is it ezLOG if you want to use it. Don’t forget to use this webhook proxy.
am i late??? anyways:
Steps
- you need to use a PROXY for this
i recommend using this proxy: https://webhook.lewisakura.moe - make your webhook in the desired discord channel
from discord articles:
- copy the webhook URL by pressing this button:
- go to the https://webhook.lewisakura.moe website, it’ll load their converter, paste your link and convert it:
- save the output smwhere since you’ll need this later
now hop into roblox studio and follow these steps:
- insert a new
Script
(ServerScript) intoServerScriptService
and name it whatever the hell you want - replace the default:
print("Hello World!")
code with this:
local targetUrl = "https://webhook.lewisakura.moe/api/webhooks/" --Discord webhook URL, input urs here
local GAME_NAME = "ornagebird3's gmae 🤯" --The name of the game
local GAME_IMAGE = "" -- if ya want, u can set a thumbnail for the game in the Discord bot
local http = game:GetService("HttpService")
local ds = game:GetService("DataStoreService"):GetDataStore("PlayerJoinLogger")
local DataStoreName = "PlayerSave_" -- key prefix | DataStoreName..plyr.UserId
function CreateSave(plyr)
local obj = {
JoinTime = os.time(),
DataVersion = 1
}
http:JSONEncode(obj)
ds:SetAsync(DataStoreName..plyr.UserId,obj)
end
function NewJSON(content,username,avatar_url)
local obj = {
['content'] = content,
['username'] = username,
['avatar_url'] = GAME_IMAGE
}
return http:JSONEncode(obj)
end
game.Players.PlayerAdded:connect(function (plyr)
local saveData = ds:GetAsync(DataStoreName..plyr.UserId)
if not saveData then
CreateSave(plyr)
local msgObj = NewJSON(plyr.Name.." has joined for the first time. ID: "..plyr.UserId,GAME_NAME)
http:PostAsync(targetUrl, msgObj)
elseif os.time() - saveData.JoinTime > 86400 then -- check if player did not join <24 hours ago, comment this out if u want to log every join
CreateSave(plyr)
local msgObj = NewJSON(plyr.Name.." has joined a game. ID: "..plyr.UserId,GAME_NAME)
http:PostAsync(targetUrl, msgObj)
end
end)
- in that code, edit the
targetUrl
variable;
just paste the link you copied or saved earlier within the quotation marks - you can edit other variables and other sections of the code if you’d like (i left comments there)
yeah uh im too lazy to explain the code so erm
LAST AND MOST IMPORTANT STEP!!!
step 5.
mark me as solution (even if i didn’t help /j)
oh yeah and dont forget to close out of ur script to save it !!
TYSM!!! it helped! here is ur solution
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.