Trying to make a plugin for players to be able to attach a lock on vending machines. The function is working but the visible lock/codelock is not visible on the deployed vending machine. Is this function/method no longer work?

var newLock = GameManager.server.CreateEntity(
                lockPrefab,
                position,
                vendingRotation
            ) as BaseLock;
newLock.SetParent(vendingMachine, vendingMachine.GetSlotAnchorName(BaseEntity.Slot.Lock));
                newLock.Spawn();