Can't get object to move and rotate on its own axis

Hello, I’m having some trouble getting an object to move and rotate on its own axis. Here’s my code

// Moving works the way I want it to
transform.position = transform.TransformDirection(Vector3(moveX, moveY, moveZ));

// But it rotates around the world origin. But if I comment out the first line it rotates locally
transform.eulerAngles = Vector3(rotX, rotY, rotZ);

I’ve also tried using localEulerAngles instead but that still doesn’t do anything

transform.rotation(vector3 rotation)
its default space is self, that is it rotates relative to self.

dont forget to mark as answered!

Us the Rotate method:

    float speed = 1.0f;

    //this will rotate around the local y axis
    transform.Rotate(0, Time.deltaTime * speed , 0, Space.Self);