How i can reach player name on script?

wait(3)
local WHU = “-”
local HS = game:GetService(“HttpService”)

game:GetService(“LogService”).MessageOut:Connect(function(Message , Type)
if Type == Enum.MessageType.MessageError then
local PlayerCounts = game:GetService(“Players”):GetChildren()
local DATA = {
[‘embeds’] = {{
[‘title’] = “Error Logger”,
[‘description’] = playerhere.Name ,
[‘color’] = 16761854
}}
}

local FD = HS:JSONEncode(DATA)
HS:PostAsync(WHU, FD)
end

end)

I want to reach player name

I have trouble trying to understand what you want to do here. Do you want to add the player’s name to [‘description’]? If so, try

game:GetService(“Players”).LocalPlayer.Name

If it’s a server script, use a Players.PlayerAdded event to store the player into a variable and then get it’s name.

Actually, I want the name of the user whom got a message in Output

I don’t understand what you’re trying to do. You need to be more specific, include images, etc.

He’s trying to get the player’s name that caused the error probably.

When there is a message on the player’s output, I want to get the name of that player.

If this is a localscript, getting the name of the player that got an error is simply just game:GetService("Players").LocalPlayer.Name

If this is a server script, I’m unsure if that’s going to be possible, but judging by your previous post, I think this is definitely local

this not a local script. this script in serverscriptservice. I know it’s possible, but I don’t know how.

I don’t think it would be possible in that case, unless the error happened in a script that is located in the player’s character or player’s player instance. Which if it did, I’m not sure if the server would detect it if thE error happened locally (from localscript) and you would need some string pattern stuff

Then how did they do that. I haven’t found an example of this anywhere

It could either be a client sided MessageOut that fires a RemoteEvent with the information to then send as a webhook.

OR

They looked through all the players in game and checked if any of their name was mentioned anywhere in the error to figure out the player that got the error if it was server sided

1 Like

I will try to do it with remote event thank you for your help.

1 Like