honestly i have no code for this because i dont have a single clue how to make it
Use Camera:WorldToViewportPoint() to see if a point is visible based on the direction the camera is facing and Camera:GetPartsObscuringTarget() to see if said point is obscured by any terrain/parts.
you can try this code
--get player mouse
local Players = game.Players
local RunService = game:GetService("RunService")
local LocalPlayer = Players.LocalPlayer
local mouse = LocalPlayer:GetMouse()
RunService.RenderStepped:Connect(function()
if mouse.Target ~= nil then --check is player mouse.Target is not nil
if mouse.Target:IsA("Part") then --check is player mouse.Target is a part
mouse.Target:Destroy()
end
end
end)
That will focus on mouse not character
Do ray cast from humanoidRootPart or Head look vector and extend that by x studs. Im on mobile so i cant type this for you