local userids = { -- table to hold the userids
107157606, -- my user id for example
1 -- roblox's userid
}
Players.PlayerAdded:Connect(function(player)
if table.find(userids, player.UserId) then
-- log their chat
end
end)
I don’t recommend using their username because if they change it, their chat won’t be logged anymore.
i really don’t reccomend sending a webhook everytime a player has chatted. It can overload very quick.
A work-around i can think of is logging all the mesages in one table, and only sending the webhook once.
local Logs = {}
game.Players.PlayerAdded:Connect(function(plr)
Logs[plr] = {}
plr.Chatted:Connect(function(message)
table.insert(Logs[plr], message)
end)
end)
game.Players.PlayerRemoving:Connect(function(plr)
local ChatHistory = Logs[plr]
--put them into one string
local s = ""
for _,msg in pairs(ChatHistory) do
s = s..msg.." \n"
end
--//rest of the webhook stuff here, sending string s
end)