Your issue is that you're using %player.getEyePoint() instead of %player.getEyeVector() to get the direction they're looking at.
You have:
%target = ContainerRayCast(%player.getEyePoint(), vectorAdd(%player.getEyePoint(), vectorScale(%player.getEyePoint(), 10)), $TypeMasks::FxBrickObjectType | $TypeMasks::FxBrickAlwaysObjectType);
It should be:
%target = ContainerRayCast(%player.getEyePoint(), vectorAdd(%player.getEyePoint(), vectorScale(%player.getEyeVector(), 10)), $TypeMasks::FxBrickAlwaysObjectType);
The other change I made is removing $TypeMasks::FxBrickObjectType because, as the name implies, $TypeMasks::FxBrickAlwaysObjectType covers bricks in all scenarios.
Other issues I found:
if(!%target.client == %player.client) { //if the guy who clicked it isn't the same guy who owns the brick
The ! operator is a boolean "not" operator. This means it converts true values to false values, and false values to true values. Assuming %target.client exists, the ! operator will change its interpretation to false. If %target.client was "" or 0, it would change its interpretation to true. So basically this can have a value of either 0 or 1, and you're comparing it to a variable that will always have a value that is neither 0 nor 1.
What you meant to do was use the not equals operator, !=. In Lua, it's ~=. The line should look like this:
if(%target.client != %player.client) { //if the guy who clicked it isn't the same guy who owns the brick
You're also using a really weird indentation scheme for brackets. Usually closing brackets are never left on the same line as whatever came before it. This isn't an actual issue, it's just a nit-picky kind of thing.