Help me with my script

  1. I want to make Error Logs Gui for everyone to see in-game errors to debug it
  2. For some reasons this script won’t work
local ScriptContext = game:GetService("ScriptContext")

ScriptContext.Error:Connect(function(Message, Trace, Script)
print("Found Error")
for i,v in pairs(game.Players:GetChildren()) do
		print(v)
		local Gui = v.PlayerGui:WaitForChild("ErrorLogsForEveryone")
		local Clone = Gui.MainFrame.Template:Clone()
		Clone.Visible = true
		Clone.Text = "Problem: "..Message.."\nLine: "..Trace
		Clone.Parent = Gui.MainFrame
end
end)

I checked and for some reasons script stops working when reaches for i,v without errors

Print cant have objects, it has to be a string, as well I recommend having brackets around strings that contain code

local ScriptContext = game:GetService("ScriptContext")

ScriptContext.Error:Connect(function(Message, Trace, Script)
print("Found Error")
for i,v in pairs(game.Players:GetChildren()) do
		print(v.Name) --can't print an object
		local Gui = v.PlayerGui:WaitForChild("ErrorLogsForEveryone")
		local Clone = Gui.MainFrame.Template:Clone()
		Clone.Visible = true
		Clone.Text =  ("Problem: "..Message.."\nLine: "..Trace) --Brackets might help
		Clone.Parent = Gui.MainFrame
end
end)

Thats not the case It won’t do anything when reaches for i,v for some reasons

What is the error code in studio (if there is one)?

There is no errors and I already fixed it by using FireAllClients RemoteEvent But thanks for trying to help me