There is unfortunately not an elegant way to do this using the mouse Icon property.
Resizing Mouse Icon
There are two options for achieving this effect:
Use Mouse Icon, and upload a number of different icons with different amounts of empty space around the central sprite (but I believe same overall widths are necessary). More empty space --> smaller icon. Uploading as many as you feel is necessary to be a good continuum of sizes.
Set the Mouse icon to something blank, and actually use some GUI object as the icon.
To go about implementing this, there are three components to consider:
a) Determining size of cursor (under either 1) or 2) from above) based on distance
b) Determining distance to thing pointing at
c) Updating the icon frequently
Determining Cursor Size for Distance
I will be considering this in terms of the GUI solution, but the math here could be used to switch between the equivalently sized icons.
We know several things about our width as a function of distance:
width(d) is maximally some number, and the maximum is at d = 0; width(d) is minimally some number, and the minimum is at d = ?. Here's a sample width function that you could use, but you could also use your own:
function cursorWidth(distance)
return 20 + 20 / (distance/10 + 1);
end
Determining Distance to Thing Pointing At
This is an easy thing. It's the distance between mouse.Hit.p and the player's head (or camera if you would prefer)
local head = game.Players.LocalPlayer.Character.Head.Position;
local point = mouse.Hit.p;
local distance = (head - point).magnitude;
Updating Cursor Constantly
So, obviously we need to constantly set the width of our icon in order for this work to be used. We could either do a while loop constantly working, or use the Moved event of the mouse.