How would I check if something isn't being obstructed by another part?

I think I fixed it, here’s what I did:

local function isObstructed(obj)--
	print(obj)
    rayParams.FilterDescendantsInstances = {game.Players.LocalPlayer.Character}
	local castResult = workspace:Raycast(camera.CFrame.Position, (getPosition(obj)-camera.CFrame.Position)*REACH, rayParams)
	print(castResult, castResult.Instance)
	if obj:IsA("Model") then
		for _, descendant in obj:GetDescendants() do
			if castResult.Instance == descendant then
				return not castResult
			end
		end
	end
	return not (castResult and castResult.Instance == obj)
end

(Will update you if I come across issues later down the line)

Thanks for your help, you were very helpful and I respect you for that! Have a good day/night!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.