# Troubleshooting

Are you facing bugs or weird behavior when using the module? Try debugging your code using these steps!

* Ensure that the module is inside StarterGui only.
* Check if you passed correct parameters when using functions. Refer to [the API](https://jaipack17.gitbook.io/raycast2/getting-started/api).
* The 'parent' parameter in :Cast() must be a ScreenGui instance.
* There are Two kinds of object the module uses when checking for intersections of the ray and a gui object. A Frame and an ImageLabel. The module only checks if the ray intersects with a Frame or an ImageLabel. If you would like to make it check for intersections with other gui Objects such as ImageButton or TextLabel. Follow these steps:\
  \
  &#x20;\- Head into RayCast2 > GlobalConstants.\
  &#x20;\- Edit the "Classes" table like this:

![](https://602295869-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Mhms8gN-uvchlIwntnZ%2F-Mhn8yeOyjoNakTWL4dz%2F-Mhn9dohwRAGRjRljg-E%2Fimage.png?alt=media\&token=33db7326-5a90-4cd1-a2aa-e6663babea07)

* If you are getting weird results/behavior, example, the position of intersection of the ray and the gui is incorrect/inaccurate. Head into RayCast2 > GlobalConstants and set "offset" to `Vector2.new(0, 0)`

<div align="left"><img src="https://602295869-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Mhms8gN-uvchlIwntnZ%2F-Mhn8yeOyjoNakTWL4dz%2F-MhnA9yHKcVi1OqlJdGF%2Fimage.png?alt=media&#x26;token=f5203523-c3e3-484c-9656-36a3a8733578" alt=""></div>

If these steps do not solve your problem, kindly reply with your problem on the [Devforum Post](https://devforum.roblox.com/t/raycast2-cast-rays-on-a-2d-surface/1430643)!
