# Part（ロブロックス クラス）

> ブロック・球・円柱などの基本の形をしたパーツです。ゲームの地面・壁・足場など、いちばんよく使う部品です。

- URL：https://roblox.minecraft-okinawa.com/reference/classes/Part/
- 公式：https://create.roblox.com/docs/reference/engine/classes/Part
- 受け継いでいるクラス：FormFactorPart

形（Shape）は Block（直方体）・Ball（球）・Cylinder（円柱）・Wedge（くさび形）・CornerWedge から選べます。色・大きさ・固定などのプロパティは BasePart から受け継いでいます。

## 使用例：パーツを10個作って並べる

（Script／置く場所：ServerScriptService）

```lua
for i = 1, 10 do
	local part = Instance.new("Part")
	part.Size = Vector3.new(4, 1, 4)
	part.Position = Vector3.new(i * 5, 10, 0)
	part.Anchored = true
	part.BrickColor = BrickColor.random()
	part.Parent = workspace
end
```

## 使用例：クリックで色が変わるパーツ

（Script／置く場所：パーツの中）

```lua
local part = script.Parent :: BasePart
local clickDetector = Instance.new("ClickDetector")
clickDetector.Parent = part

clickDetector.MouseClick:Connect(function()
	part.Color = Color3.fromRGB(math.random(0, 255), math.random(0, 255), math.random(0, 255))
end)
```

## プロパティ

- `Part.Shape: PartType`：パーツの形（Block・Ball・Cylinder・Wedge・CornerWedge）。

英語の説明とメンバー一覧：Roblox Creator Documentation（CC BY 4.0）。日本語の解説はこのサイト独自のものです。

執筆：鈴木孝昌（現役プロジェクトマネージャー／プログラミング講師）／運営：沖縄マイクラ部 プログラミングスクール「クロスウェーブ」（https://minecraft-okinawa.com/）