Function returning false in blueprint

I’m experimenting with creating my own custom blueprints, and I hit upon something I can’t explain.

I create a class with extended UBlueprintFunctionLibrary, make the UFUNCTION for my function BlueprintCallable. The function is just returning a bool true every time.

However when I get into the blueprints, and actually put my function out on the graph, set target to my class and print the result, it always returns false. I have no idea what the problem could be because there’s no way my function can even return false.

I’m stuck thinking it’s something with how I get an object of my class and that it thinks it’s an object of the class but it’s actually not or something like that.

UCLASS(Blueprintable) //Uclass
UFUNCTION(BlueprintCallable, Category = "Test") //My function



UFUNCTION(BlueprintCallable, Category = "UDP Networking")
bool ConnectToServer(int32 port);

bool UGameServer::ConnectToServer(int32 port)
{

	
	FString address = TEXT("127.0.0.1");

	TSharedRef < FInternetAddr > addr = ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM)->CreateInternetAddr();
	FIPv4Address ip;
	FIPv4Address::Parse(address, ip);

	addr->SetIp(ip.GetValue());
	addr->SetPort(port);
	//bool connected = Socket->Connect(*addr);
	//Socket->Bind(*addr);
	Socket = FUdpSocketBuilder(TEXT("default"))
		.AsNonBlocking()
		.AsReusable()
		.BoundToAddress(ip)
		.BoundToPort(port);

	GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, FString::FromInt(port));
	GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, Socket ? TEXT("trueee") : TEXT("falseee"));
	if (Socket)
	{
		return true;
	}
	else
	{
		return true;
	}
	return true;
}

Can you post the signature of your function?

Code apparently didn’t like being in comments, I’ll put it in the topic instead.