So I have this script here that changes the velocity of a conveyor belt depending on what orientation it has. For right, up and down it works fine but for left it just doesn't work. Why is that? Any questions will be answered asap.

local currentgrid = script.Parent
local typebuilding = script.Parent:WaitForChild("typebuilding") -- ObjectValue
local buildingorientation = script.Parent:WaitForChild("buildingorientation") --NumberValue

local direction = ""

function CheckDirection()
	while true do
		wait()
		if typebuilding ~= nil and typebuilding.Value ~= nil and typebuilding.Value.Grid ~= nil then
			if typebuilding.Value.Grid.Orientation.Y == 0 then
				direction = "right"
			elseif typebuilding.Value.Grid.Orientation.Y == 90 then
				direction = "up"
			elseif typebuilding.Value.Grid.Orientation.Y == 180 then
				direction = "left"
			elseif typebuilding.Value.Grid.Orientation.Y == -90 then
				direction = "down"
			end
		end
	end
end

spawn(CheckDirection)

while true do
	wait()
	if direction ~= nil then print(direction) end
	if typebuilding.Value ~= nil and typebuilding.Value.Name == "ConveyorBelt" and direction == "right" then
		typebuilding.Value.Main.Conveyor.Velocity = Vector3.new(0,0,10)
	elseif typebuilding.Value ~= nil and typebuilding.Value.Name == "ConveyorBelt" and direction == "left" then
		typebuilding.Value.Main.Conveyor.Velocity = Vector3.new(0,0,-10)
	elseif typebuilding.Value ~= nil and typebuilding.Value.Name == "ConveyorBelt" and direction == "up" then
		typebuilding.Value.Main.Conveyor.Velocity = Vector3.new(10,0,0)
	elseif typebuilding.Value ~= nil and typebuilding.Value.Name == "ConveyorBelt" and direction == "down" then
		typebuilding.Value.Main.Conveyor.Velocity = Vector3.new(-10,0,0)	
	end
end