How to create and attach a UActorComponent at runtime

Hey everyone,
I’m trying to create a UActorComponent and attach it to an AActor. I am creating the component outside of the actor I want to attach it to. The commented stuff is just some stuff I tried but also failed.

(In case that pic is too small)

UPloppableComponent* NewPloppableComp = NewObject(PlaceableActor, UPloppableComponent::StaticClass(), TEXT(“PloppableComponent”), RF_Transient);

PlaceableActor->AddInstanceComponent(NewPloppableComp);

	//FTransform transform;
	//PlaceableActor->AddComponent(TEXT("PloppableComponent"), false, transform, UPloppableComponent::StaticClass());
	
	//UActorComponent* NewComp = NewObject<UActorComponent>(PlaceableActor, UPloppableComponent::StaticClass(), TEXT("PloppableComponent"));
	//NewComp.(PlaceableActor->GetRootComponent());

Hey! try call the RegisterComponent function and call AttachToComponent or AttachToActor *

If anyone ever has the same problem as me, you do not need to call AttachToComponent or AttachToActor, you actually can’t (at least from what I know) since this is a UActorComponent. I was just misreading the error RegisterComponent was giving me.
Anyway thanks for the help!