# How It Works

#### **1️⃣ Spotlight Motion System**

Each spotlight dynamically oscillates **left-right** using a set movement speed and range. The angle gradually increases or decreases within a threshold, ensuring fluid motion.

* `light.angle` dynamically adjusts based on movement speed.
* The spotlight’s **X** and **Y** positions shift according to the calculated sine wave motion.
* If the spotlight reaches the maximum angle, it reverses direction for continuous movement.

#### **2️⃣ Player Detection System**

The script continuously checks if a player is inside the moving light beam by:

* Comparing the player’s position with the spotlight’s current position.
* Verifying if the player is within the specified **light range**.
* Triggering a **Police Notification Event** if the player is detected in the area.

#### **3️⃣ Police Alert Mechanism**

* **Cooldown System**: Ensures alerts are not spammed by introducing a **5-second cooldown**.
* **Automated Detection**: If a player repeatedly enters the spotlight, a notification is sent.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://god-studios.gitbook.io/god-studios/god-dynamic-spotlights-and-detection-system/how-it-works.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
