PcoWSkbVqDnWTu_dm2ix
Collapse Sidebar

CursorIcon

ClickDetector

Content

The CursorIcon sets the mouse icon that will be displayed when the Mouse/mouse hovers over this ClickDetector.

If this property is left blank, the ClickDetector will use the default icon:

Default cursor icon

To change the ClickDetector’s cursor icon, set the property to the asset id or URL of the image you would like to use. For instance, setting the property to 2287179377 or this URL changes the cursor icon to:

Custom cursor icon


Code Samples


Creating a ClickDetector Door

The code sample below demonstrates the functionality of a ClickDetector and its properties and events.

First the code creates a ClickDetector and set’s its Instance/Parent|parent to the door. It also sets the ClickDetector/MaxActivationDistance|maximum distance players can interact with the ClickDetector to 10 studs and set’s the ClickDetector’s ClickDetector/CursorImage|CursorImage to:

Custom cursor image

Then, the code connects the ClickDetector to several events, including changing the door’s BasePart/Transparency when the player’s mouse hovers ClickDetector/MouseHoverEnter|on and ClickDetector/MouseHoverLeave|off off the door. The player opens the door by ClickDetector/MouseClick|left clicking their mouse while over the ClickDetector and closes the door by ClickDetector/RightMouseClick|right clicking their mouse while over the ClickDetector.

This code works in a Script and a LocalScript as long as the script’s parent is the door BasePart|Part.