Did I correctly capture the character with RayCast if it is in front of an object?

Well, I’m wanting to make a system that opens the door based on the direction of the character. I’ve already done the part of detecting the character, but I’m new to RayCast, so I don’t know if it’s right.

local ReplicatedStorage = game:GetService("ReplicatedStorage");
local Players = game:GetService("Players")
local TS = game:GetService("TweenService");

local frame = script.Parent:WaitForChild("Frame");
local proximity = frame:WaitForChild("ProximityPrompt");

local LeftD = script.Parent:WaitForChild("Left_Door");
local RightD = script.Parent:WaitForChild("Right_Door");

local enabled = true;

proximity.Triggered:Connect(function(plr)
	local character = workspace[plr.Name]

	local Direction = (frame.CFrame * CFrame.Angles(0, math.rad(-90), 0)).LookVector--It rotates it 90° because I modeled the door wrong, but that's how it turns out

	local raycastParams = RaycastParams.new()
	raycastParams.FilterType = Enum.RaycastFilterType.Whitelist
	raycastParams.FilterDescendantsInstances = {character}
	local raycastResult = workspace:Raycast(frame.Position, Direction * 100, raycastParams) -- Rayo de 10 unidades de longitud

	if raycastResult and raycastResult.Instance.Parent == character then -- Donde 'object' es el objeto que quieres verificar
		print("yes")
	else
		print("no")
	end

	if enabled then
		
	end
end)

Instead of raycasting from the door outwards, raycast infront of where the player is facing

-- root is the players characters HumanoidRootPart
local direction = root.CFrame.LookVector * 10

And check if the hit is the door