im looking for a substitute for mouse.hit but this does not make a ray pointing to the mouse position like the wiki said it would, please help
local uIS = game:GetService("UserInputService")
local mouse = uIS:GetMouseLocation()
local camera = workspace.CurrentCamera
uIS.InputBegan:Connect(function(input, processed)
if processed then return end
if input.UserInputType == Enum.UserInputType.MouseButton1 then
local unitRay = camera:ViewportPointToRay(mouse.X, mouse.Y, 0)
local ray = workspace:Raycast(unitRay.Origin, unitRay.Direction * 100)
if ray then
print(1)
print(ray.Instance.Name)
end
end
end)
