# Spawner

## Spawner

월드상에 설정된 조건에 맞게 오브젝트를 생성하는 객체에요.\
[Game:AddObjectSpawner](https://ditoland-utplus.gitbook.io/ditoland/api-reference/server/game) 함수로 생성해요.

### **함수**

<br>

| **void AddSpawnObject(Object SpawnObject, number SpawnRate, number MaxCount)** |
| ------------------------------------------------------------------------------ |

스폰 오브젝트를 추가할 수 있어요. (SpawnObject : 스폰 오브젝트, SpawnRate : 스폰 확률, MaxCount : 최대 스폰 개수)

<br>

| **void AddSpawnObject(Object SpawnObject, number SpawnRate, number MaxCount, Vector OffsetPosition)** |
| ----------------------------------------------------------------------------------------------------- |

스폰 오브젝트를 추가할 수 있어요. (SpawnObject : 스폰 오브젝트, SpawnRate : 스폰 확률, MaxCount : 최대 스폰 개수, OffsetPosition : 생성 위치 오프셋)

\-- 샘플 --

```lua
local toy = Script.Parent
local spawnTime = 1
local spawnLimit = 1 --생성 제한 수(생성된 객체가 이 수보다 작아야 생성됩니다.)
local spawner = Game:AddObjectSpawner(toy, Enum.ObjectSelectType.Random, spawnTime, spawnLimit) --오브젝트를 스폰할 스포너를 등록해요.

local spawnRate = 0.9
local maxSpawnCount = 9999 --최대 생성 수(이 수 만큼 생성되면 생성이 종료됩니다.)
local spawnPos = Vector.new(0, 0, 0)

spawner:AddSpawnObject(Toybox.Cube, spawnRate, maxSpawnCount, spawnPos) --스포너에서 스폰할 오브젝트를 등록해요.
```

<br>

| **void SetObjectSpawnType\_Scale()** |
| ------------------------------------ |

오브젝트의 스폰 형식을 스포너의 크기에 따라 랜덤으로 스폰되게 설정해요.

<br>

| **void SetObjectSpawnType\_Range(Vector MinRange, Vector MaxRange)** |
| -------------------------------------------------------------------- |

오브젝트의 스폰 형식을 범위 내에 랜덤으로 스폰되게 설정해요. (MinRange : 최소 범위, MaxRange : 최대 범위)

\ <br>

## **사용 가능한 부모 오브젝트 기능들**

### **속성**

| **이름**                                                                                | **설명**               |
| ------------------------------------------------------------------------------------- | -------------------- |
| [**Parent**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/object) | **부모 객체를 얻을 수 있어요.** |
| [**Name**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/object)   | **객체의 이름입니다.**       |

### **이벤트**

| **이름** | **설명** |
| ------ | ------ |

### **함수**

| **이름**                                                                                                    | **설명**                                                                                                                                                                                         |
| --------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [**ConnectChangeEventFunction**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/object) | **추가된 값이 변경 될 때 호출되는 이벤트에요. (Value 이름, 연결 함수)**                                                                                                                                                |
| [**GetChild**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/object)                   | **이름으로 자식 객체를 얻을 수 있어요. (찾고싶은 자식 객체 이름)**                                                                                                                                                      |
| [**GetChildList**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/object)               | **자식 객체의 리스트를 얻을 수 있어요.**                                                                                                                                                                      |
| [**IsCharacter**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/object)                | **캐릭터인지 확인할 수 있어요.**                                                                                                                                                                           |
| [**IsStaticMesh**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/object)               | **스테틱 메시인지 확인할 수 있어요.**                                                                                                                                                                        |
| [**IsFX**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/object)                       | **FX인지 확인할 수 있어요.**                                                                                                                                                                            |
| [**IsSound**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/object)                    | **Sound인지 확인할 수 있어요.**                                                                                                                                                                         |
| [**IsPointLight**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/object)               | **포인트 라이트인지 확인할 수 있어요.**                                                                                                                                                                       |
| [**IsSpotLight**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/object)                | **스포트 라이트인지 확인할 수 있어요.**                                                                                                                                                                       |
| [**IsSurfaceUI**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/object)                | **서피스 UI인지 확인할 수 있어요.**                                                                                                                                                                        |
| [**IsScreenUI**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/object)                 | **스크린 UI인지 확인할 수 있어요.**                                                                                                                                                                        |
| [**IsTouchUI**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/object)                  | **터치 UI인지 확인할 수 있어요.**                                                                                                                                                                         |
| [**IsItem**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/object)                     | **아이템인지 확인할 수 있어요.**                                                                                                                                                                           |
| [**IsNPC**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/object)                      | **NPC인지 확인할 수 있어요.**                                                                                                                                                                           |
| [**IsScript**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/object)                   | **스트립트인지 확인할 수 있어요.**                                                                                                                                                                          |
| [**IsCollider**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/object)                 | **Collider인지 확인할 수 있어요.**                                                                                                                                                                      |
| [**IsWidget**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/object)                   | **Widget인지 확인할 수 있어요.**                                                                                                                                                                        |
| [**IsCamera**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/object)                   | **Camera인지 확인할 수 있어요.**                                                                                                                                                                        |
| [**IsValid**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/object)                    | **해당 오브젝트가 유효한지 확인 할 수있어요.**                                                                                                                                                                   |
| [**IsValidValue**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/object)               | **해당 오브젝트의 값이 유효한지 확인할 수 있어요.**                                                                                                                                                                |
| [**AddReplicateValue**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/object)          | **해당 객체에 서버, 클라이언트 간 동기화가 가능한 벡터를 추가해요. (추가할 Value 이름, Vector 데이터,** [**Enum.ReplicateType.타입**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/enums/replicatetype) **, 동기화 시간)**  |
| [**AddReplicateValue**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/object)          | **해당 객체에 서버, 클라이언트 간 동기화가 가능한 실수를 추가해요. (추가할 Value 이름, number 데이터,** [**Enum.ReplicateType.타입**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/enums/replicatetype) **, 동기화 시간)**  |
| [**AddReplicateValue**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/object)          | **해당 객체에 서버, 클라이언트 간 동기화가 가능한 bool를 추가해요. (추가할 Value 이름, bool 데이터,** [**Enum.ReplicateType.타입**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/enums/replicatetype) **, 동기화 시간)**  |
| [**AddReplicateValue**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/object)          | **해당 객체에 서버, 클라이언트 간 동기화가 가능한 문자열을 추가해요. (추가할 Value 이름, string 데이터,** [**Enum.ReplicateType.타입**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/enums/replicatetype) **, 동기화 시간)** |
| [**AddReplicateValue**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/common/object)          | **해당 객체에 서버, 클라이언트 간 동기화가 가능한 컬러를 추가해요. (추가할 Value 이름, Color 데이터,** [**Enum.ReplicateType.타입**](https://ditoland-utplus.gitbook.io/ditoland/api-reference/enums/replicatetype) **, 동기화 시간)**   |


---

# 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://ditoland-utplus.gitbook.io/ditoland/api-reference/server/spawner.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.
