Time not updating with Webhook

Having problems with setting up the Time for my Webhook, it works but it doesn’t update the time when I leave the game.

local timestamp = DateTime.now():ToIsoDate()

PLAYERS.PlayerAdded:Connect(function(player)
	local s, PictureUrl = pcall(function()
		return HTTP:JSONDecode(HTTP:GetAsync("..."))
	end)

	if s and PictureUrl then
		PictureUrl=PictureUrl.data[1].imageUrl
	else
		PictureUrl="..."
	end
	
	
	local DATA = {
		["embeds"] = {
				{
			
					["title"] = "**Click me to view Profile!**";
					["description"] = player.Name.." is now in Main Game.";
					["color"] = 4062976;
					["url"] = "https://www.roblox.com/users/"..player.UserId.."/profile";
				
					["fields"] = {
						{
							["name"] = "Leave Time";
							["value"] = timestamp;
							["inline"] = false;
						},
					};
				
					["thumbnail"] = {
							["url"] = PictureUrl;
					};
				}
			}
		}
	local FINALDATA		= HTTP:JSONEncode(DATA)
	task.wait(1)
	HTTP:PostAsync(URL, FINALDATA)
	task.wait(25)
end)

is there a way I can get it to keep updating per second?

1 Like

The script will only run if someone is playing the game as then a server will be open

yeah, and I want to get the time to keep updating, it works with both os.date() however, whenever a user left it gives the same output as the one when they joined the game

bump, still need help with this one. Can anyone figure this out for me?

why was the message deleted? :sob:

I’m not sure if this is what you want.

PLAYERS.PlayerAdded:Connect(function(player)
	local timestamp = DateTime.now():ToIsoDate()
	local s, PictureUrl = pcall(function()
		return HTTP:JSONDecode(HTTP:GetAsync("..."))
	end)

	if s and PictureUrl then
		PictureUrl=PictureUrl.data[1].imageUrl
	else
		PictureUrl="..."
	end
	
	
	local DATA = {
		["embeds"] = {
				{
			
					["title"] = "**Click me to view Profile!**";
					["description"] = player.Name.." is now in Main Game.";
					["color"] = 4062976;
					["url"] = "https://www.roblox.com/users/"..player.UserId.."/profile";
				
					["fields"] = {
						{
							["name"] = "Join Time";
							["value"] = timestamp;
							["inline"] = false;
						},
					};
				
					["thumbnail"] = {
							["url"] = PictureUrl;
					};
				}
			}
		}
	local success, err = pcall(function()
		local FINALDATA		= HTTP:JSONEncode(DATA)
		HTTP:PostAsync(URL, FINALDATA)
	end)
	if not success then
		task.wait(3)
		local FINALDATA		= HTTP:JSONEncode(DATA)
		HTTP:PostAsync(URL, FINALDATA)
	end
end)

PLAYERS.PlayerRemoving:Connect(function(player)
	local timestamp = DateTime.now():ToIsoDate()
	local s, PictureUrl = pcall(function()
		return HTTP:JSONDecode(HTTP:GetAsync("..."))
	end)

	if s and PictureUrl then
		PictureUrl=PictureUrl.data[1].imageUrl
	else
		PictureUrl="..."
	end
	
	
	local DATA = {
		["embeds"] = {
				{
			
					["title"] = "**Click me to view Profile!**";
					["description"] = player.Name.." is leaving Main Game.";
					["color"] = 4062976;
					["url"] = "https://www.roblox.com/users/"..player.UserId.."/profile";
				
					["fields"] = {
						{
							["name"] = "Leave Time";
							["value"] = timestamp;
							["inline"] = false;
						},
					};
				
					["thumbnail"] = {
							["url"] = PictureUrl;
					};
				}
			}
		}
	local success, err = pcall(function()
		local FINALDATA		= HTTP:JSONEncode(DATA)
		HTTP:PostAsync(URL, FINALDATA)
	end)
	if not success then
		task.wait(3)
		local FINALDATA		= HTTP:JSONEncode(DATA)
		HTTP:PostAsync(URL, FINALDATA)
	end
end)```

ooo so like put the Timestamp inside as well? I’ll try if that works