Why is my calculator class not finding a table?

I am attempting to make a class that handles all calculation of the amount of coins a player gets per sell but for some reason i get the error “attempt to index nil with getStat” even though when I printed out getPlayerManager it prints out a table instead of nil which is what the getStat is suppossed to be referencing.

local Calculator = {}
Calculator.__index = Calculator

local CalculatorObjects = {}

--//SERVICES
local ServerScriptService = game:GetService("ServerScriptService")

--//CLASSES-MODULES
local StatsManager = require(ServerScriptService.Data.StatsManager)

function Calculator.new(player)
    local self = setmetatable({}, Calculator)

    self.Player = player

    self.PlayerStatManager = StatsManager:getPlayerManager(self.Player)

    CalculatorObjects[player.Name] = self

    return CalculatorObjects[player.Name]
end

function Calculator:getCalculator(player)
    if CalculatorObjects[player.Name] then
        return CalculatorObjects[player.Name]
    else
        warn(player.Name.." does not have a calculator")
    end
end

function Calculator:destroy()
    CalculatorObjects[self.Player.Name] = nil
end

function Calculator:calculateEggAmount()
    --EGGS = 1 * (LEVEL / 2) * PetBonus * World Boost
    local EggAmount = 1
    
    return EggAmount
end

function Calculator:calculateCoinAmount()
    --COINS = 2 * PetBonus * World Boost
    local CoinAmount = 2

    return CoinAmount * self.PlayerStatManager:getStat("EggAmount", "PlayerStats")
end 

return Calculator```

Have you made sure to set a metatable to your PlayerStatManager in its source? The code seems to run for me if I do that.