rayCast problem, Important

pullingRemote.OnServerEvent:Connect(function(player) -- Pulling
	local character = player.Character
	local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
	local humanoid = character:WaitForChild("Humanoid")
	
	local camera = game.Workspace.CurrentCamera
	local rayStart = camera.CFrame.Position
	local rayDirection = camera.CFrame.LookVector * 10000 -- Increasing the length of the ray for expanding the search area

	local raycastParams = RaycastParams.new()
	raycastParams.FilterType = Enum.RaycastFilterType.Whitelist
	raycastParams.FilterDescendantsInstances = {workspace} -- Searching only within the player's character

	local raycastResult = workspace:Raycast(rayStart, rayDirection, raycastParams)
	if raycastResult then
		local hitPart = raycastResult.Instance
		print(player.Name .. " is looking at the object with the name: " .. hitPart.Name)
	end
end)

So the problem is that when I look at a part and call an event, it keeps writing basePlate, even though I’m not looking at it. Why am I doing something wrong?

Are you 100% sure you’re not looking at it? The camera may still be pointing at it.

Whitelist is deprecated. Use Enum.RaycastFilterType.Exclude or Enum.RaycastFilterType.Include instead.

At the moment nothing is output at all

If you want to search only within the player’s character, you’d add said character to the filterdescendantsinstance table, not workspace.