Player not attaching to mouse controlled platforms

I have a 2D game with a player character and an object controlled by the mouse via MovePosition and therefore they’re both rigid bodies, so I can’t attach them via parenting. Is there anything I can do, whether it be changing the object movement script or finding a method other than parenting to get the player to move with the moving platform?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;


public class DraggingObject : MonoBehaviour
{
private Vector3 mousePos;
public float moveSpeed = 1.0f;
public Rigidbody2D rb;
Vector2 position = new Vector2(0f, 0f);
bool dragging = false;

    private void Start()
    {
        rb = GetComponent<Rigidbody2D>();
    }
    private void Update()
    {
        mousePos = Input.mousePosition;
        mousePos = Camera.main.ScreenToWorldPoint(mousePos);
        position = Vector2.Lerp(transform.position, mousePos, moveSpeed);
    }
    private void FixedUpdate()
    {
        if (dragging)
        {
            rb.MovePosition(position);
        }
    }
    private void OnMouseDown()
    {
        dragging = true;
    }
    private void OnMouseUp()
    {
        dragging = false;
    }
}

Why do you need physics on a platform you are only moving via mouse drag? I’d say take the rigidbody off the platform and then parent the player like you mention.

I want the platform to be affected by gravity and collisions, plus removing the Rigidbody would disable the MovePosition command required to make it move.

There are like 5 different ways to move an object, MovePosition is just one. Collisions are handled via colliders and as long as you have a rigidbody and collider on your player, it is handled.

I would think a bit more about how gravity is affecting the platforms. Are the platforms constantly falling (or constantly pulling from a certain direction)? Cause thats what gravity does, a pull from a direction.