Script to check game and player info when console is open not working

So I want this script that can print the game ID and the players name when they open the devconsole, I know this is useless but I just want to test something, please help. The script doesn’t error It just doesn’t work.

local function isConsoleOpen()
	game.StarterGui:GetCore("DevConsoleVisible")
end
local id = game.PlaceId
local ver = game.PlaceVersion
local plrname = game.Players.LocalPlayer.Name
while true do
	wait(1)
	if isConsoleOpen() then
		print(id)
		print(ver)
		print(plrname)
	end
end

you need the isConsoleOpen function to be

local function isConsoleOpen()
	return game.StarterGui:GetCore("DevConsoleVisible")
end

so it actually returns a bool