As told above in the title.
Is therw an option that registers when and which player joined your game?
i know there was a long time ago a script like this which works with a Google-script thing, but i can't find it anymore :-(
As told above in the title.
Is therw an option that registers when and which player joined your game?
i know there was a long time ago a script like this which works with a Google-script thing, but i can't find it anymore :-(
Hello! So I recently answered a question that was very similar to this here: https://scriptinghelpers.org/questions/76746/getting-names-of-player-who-played-your-game#72029
The below script uses the Https Service to send a message to Discord (assuming you've set-up a webhook) that will record the time stamp and the user.
Server Script
local HTTP = game:GetService("HttpService")
local DSS = game:GetService("DataStoreService")
local Storage = DSS:GetDataStore("BasicInfo")
local webhook = "https://discordapp.com/api/webhooks/0"
game:GetService("Players").PlayerAdded:Connect(function(player)
local newdata = Instance.new("BoolValue")
newdata.Name = "HasPlayed"
newdata.Value = false
local success, result = pcall(function()
Storage:GetAsync(player.UserId)
end)
if success then
newdata.Value = Storage:GetAsync(player.UserId)
else
warn(result)
end
if newdata.Value == false then
newdata.Value = true
local msg = "Joined the Game"
local payload = HTTP:JSONEncode({content = msg, username = player.Name.." - (#"..player.UserId..")"})
HTTP:PostAsync(webhook, payload)
print("Complete")
Storage:SetAsync(player.UserId, newdata.Value)
print("Saved")
end
end)
This will add a BoolValue to the player, then check if they have any data pertaining to having already played (the pcall is to prevent errors).
If they don't have any data, the game will set the value to true and then send a message to your webhook and save the datastore.
Make sure HTTPs Service is accessible via: Studio --> Home --> Game Settings
EDIT
Recording Players Everytime they join doesn't require a DataStore Check
local HTTP = game:GetService("HttpService")
local webhook = "https://discordapp.com/api/webhooks/552233906020155393/INkYo365wvK24Haoxk2JSZPdRZGpQHiI29ViQB-WXxUZ-ENM5-fu4MxZa3h-Cp0Ct9GR"
game:GetService("Players").PlayerAdded:Connect(function(player)
local msg = "Joined the Game"
local payload = HTTP:JSONEncode({content = msg, username = player.Name.." - (#"..player.UserId..")"})
HTTP:PostAsync(webhook, payload)
print("Complete")
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
I don't know what a webhook is. Sorry :-D,. I'd like to know how it works or if you could help me with that :-). Do you mind if i contact your through roblox?
Sure, or on Discord, if you have it, SerpentineKing#0155