It might not be the most efficient, but you can dot GlobalWind with each of the direction vectors and choose the vector that resulted in the highest value.
If you take the dot product of two unit vectors, 1 means they are in the same direction, -1 means they are in the opposite direction, and 0 means they are perpendicular. Using this, given any vector the closest direction will be the one with the highest dot product (when normalizing the vectors).
local function GetDirection(vector)
vector = vector.Unit
local matchingDirection
local maxProduct = -math.huge
for i, direction in pairs(directions) do
local product = vector:Dot(direction.Direction.Unit)
if product > maxProduct then
maxProduct = product
matchingDirection = direction
end
end
return matchingDirection
end
local vector = Vector3.new(1, 0, 0.1)
local direction = GetDirection(vector)
print(direction.Name) -- "East"