Trying to log a single-session playtime for each player

I’ve tried to make a script that every time a game.Players.PlayerRemoving gets called, it prints out info about said player playtime, but the game prints nothing and outputs no errors.

local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
    local value = Instance.new("IntValue", player)
    value.Name = "TimePlayed"

    while true do
        value.Value = value.Value + 1
        wait(1)
    end

    Players.PlayerRemoving:Connect(function()
        if value.Value <=59 then
			print("Player did not play minimum required time.")
		else
            print("Player Played for ", value.Value/60, "Minutes")
        end
    end)
end)

Does anyone know how to fix that?

Restarted the local rbxl file and it started working once again.