Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Mouse.UnitRay only finding parts in the camera itself?

Asked by 8 years ago
local Mouse = MyPlr:GetMouse()
local RP = workspace:FindPartOnRay(Mouse.UnitRay, nil, false, true)
if (RP ~= nil) then -- Everything it nil
    print("0 Parent " .. RP.Name)
    print("1 Parent " .. RP.Parent.Name)
    local Find = Plrs:FindFirstChild(RP.Parent.Name) or Plrs:FindFirstChild(string.sub(RP.Parent.Name, string.len("ESPStuff ") + 1))
    if (Find and Find ~= MyPlr) then
        Aim = 500000
    else
        Aim = 1
    end
else
    Aim = 1
end

That code isn't printing anything, and I know it's working because if I put a part in the camera it'll print the name. How can create a ray from the mouse's position to a 3d position?

Answer this question