I used raycasting, I filtered out all the parts that I figured would be in the way of where you aim. I don’t know what else to filter. What is wrong with my aiming?
local MousePos = uis:GetMouseLocation()
local viewPortMouseRay = workspace.Camera:ViewportPointToRay(MousePos.X, MousePos.Y)
local Params = RaycastParams.new()
Params.FilterType = Enum.RaycastFilterType.Blacklist
local Descendants = {}
Descendants[#Descendants+1] = workspace.PointBoxes
Descendants[#Descendants+1] = workspace.PenaltyBoxes
for i,v in pairs(game.Players:GetPlayers()) do
if v.Character then
Descendants[#Descendants+1] = v.Character
end
end
Params.FilterDescendantsInstances = Descendants
local aimCast = workspace:Raycast(viewPortMouseRay.Origin, viewPortMouseRay.Direction * 500, Params)