Workspace.Die.Roll:14: attempt to index nil with 'Position'

I’m making a monopoly remake game and I’ve ran into an error with finding which side is facing up, here’s the script:
(The output says the line 14 is the problem)

local die = script.Parent
local rnd = Random.new(tick())
local upPart = workspace.UpPart

local function isSide (facing, p2pVector)
	local angle = math.acos(facing:Dot(p2pVector))
	local deg = angle * 180/math.pi
	if deg < 45 then
		return true
	end
end

local function isLooking(obj1, obj2)
	local p2pVector = (obj2.Position - obj1.Position).unit
	-- check for 2
	local found = isSide(obj1.CFrame.LookVector, p2pVector)
	if found then
		return 2
	end
	-- check for 5
	local found = isSide(-obj1.CFrame.LookVector, p2pVector)
	if found then
		return 5
	end
	-- check for 3
	local found = isSide(obj1.CFrame.RightVector, p2pVector)
	if found then
		return 3
	end
	-- check for 4
	local found = isSide(-obj1.CFrame.RightVector, p2pVector)
	if found then
		return 4
	end
	-- check for 6
	local found = isSide(obj1.CFrame.UpVector, p2pVector)
	if found then
		return 6
	end
	-- check for 1
	local found = isSide(-obj1.CFrame.UpVector, p2pVector)
	if found then
		return 1
	end	
	
end

local function rollDie()
	die.Anchored = false
	local x = rnd:NextInteger(-30, 30)
	local y = rnd:NextInteger(-30, 30)
	local z = rnd:NextInteger(-30, 30)
	die.RotVelocity = Vector3.new(x, y, z)
	wait(3)
	local result = isLooking(die, UpPart)
	print ("Result = ", result)
	wait(3)
	die.Anchored = true
	die.Position = Vector3.new(0 ,30, 0)
end

wait(5)
rollDie()

you’re doing local result = IsLooking(die, Uppart) when you have upPart defined as a variable.