了解した。
「出目金 Part モデルを Roblox Studio 内で自動生成するスクリプト」 を、あなたの OS 的な構造規律に合わせて 完全な Lua コードとして提示する。
以下は StarterPlayerScripts などで実行すると、Workspace に出目金モデルを自動生成するコード。
あなたの規律に合わせて、各 Part の意味・役割をコメント化し、構造が破綻しないようにしてある。
🧩 出目金自動生成スクリプト(Part配置コード)
-- ScriptType: Script
-- Path: StarterPlayerScripts/GenerateDemekin.lua
-- Purpose: 出目金モデルを自動生成する(Part構成)
local function CreatePart(name, shape, size, color, parent)
local p = Instance.new("Part")
p.Name = name
p.Shape = shape
p.Size = size
p.Color = color
p.Anchored = false
p.CanCollide = false
p.Massless = true
p.TopSurface = Enum.SurfaceType.Smooth
p.BottomSurface = Enum.SurfaceType.Smooth
p.Parent = parent
return p
end
local function Weld(a, b)
local w = Instance.new("WeldConstraint")
w.Part0 = a
w.Part1 = b
w.Parent = a
end
--========================================================
-- 出目金モデル生成
--========================================================
local model = Instance.new("Model")
model.Name = "Demekin"
model.Parent = workspace
--========================================================
-- 1. 胴体(BodySphere)
--========================================================
local body = CreatePart(
"BodySphere",
Enum.PartType.Ball,
Vector3.new(3,3,3),
Color3.fromRGB(255,120,120),
model
)
--========================================================
-- 2. 頭(HeadSphere)
--========================================================
local head = CreatePart(
"HeadSphere",
Enum.PartType.Ball,
Vector3.new(2.4,2.4,2.4),
Color3.fromRGB(255,140,140),
model
)
head.CFrame = body.CFrame * CFrame.new(0,0,-2.2)
Weld(head, body)
--========================================================
-- 3. 目(LeftEye / RightEye)
--========================================================
local leftEye = CreatePart(
"LeftEyeSphere",
Enum.PartType.Ball,
Vector3.new(1.2,1.2,1.2),
Color3.fromRGB(0,0,0),
model
)
leftEye.CFrame = head.CFrame * CFrame.new(-1.2,0,-0.3)
Weld(leftEye, head)
local rightEye = CreatePart(
"RightEyeSphere",
Enum.PartType.Ball,
Vector3.new(1.2,1.2,1.2),
Color3.fromRGB(0,0,0),
model
)
rightEye.CFrame = head.CFrame * CFrame.new(1.2,0,-0.3)
Weld(rightEye, head)
--========================================================
-- 4. 尾びれ付け根(TailBase)
--========================================================
local tailBase = CreatePart(
"TailBase",
Enum.PartType.Block,
Vector3.new(0.6,1.2,1.2),
Color3.fromRGB(255,150,150),
model
)
tailBase.CFrame = body.CFrame * CFrame.new(0,0,2.2)
Weld(tailBase, body)
--========================================================
-- 5. 尾びれ(TailFin)
--========================================================
local tailFin = CreatePart(
"TailFin",
Enum.PartType.Block,
Vector3.new(0.2,3,4),
Color3.fromRGB(255,180,180),
model
)
tailFin.Material = Enum.Material.SmoothPlastic
tailFin.CFrame = tailBase.CFrame * CFrame.new(0,0,2)
Weld(tailFin, tailBase)
--========================================================
-- 6. 背びれ(DorsalFin)
--========================================================
local dorsal = CreatePart(
"DorsalFin",
Enum.PartType.Block,
Vector3.new(0.2,1.5,2),
Color3.fromRGB(255,160,160),
model
)
dorsal.CFrame = body.CFrame * CFrame.new(0,1.5,0)
Weld(dorsal, body)
--========================================================
-- 7. 左右胸びれ(Pectoral)
--========================================================
local leftP = CreatePart(
"LeftPectoralFin",
Enum.PartType.Block,
Vector3.new(0.2,1,1.5),
Color3.fromRGB(255,160,160),
model
)
leftP.CFrame = body.CFrame * CFrame.new(-1.5,0,0.5)
Weld(leftP, body)
local rightP = CreatePart(
"RightPectoralFin",
Enum.PartType.Block,
Vector3.new(0.2,1,1.5),
Color3.fromRGB(255,160,160),
model
)
rightP.CFrame = body.CFrame * CFrame.new(1.5,0,0.5)
Weld(rightP, body)
--========================================================
-- 8. 口(MouthCone)
--========================================================
local mouth = CreatePart(
"MouthCone",
Enum.PartType.Ball,
Vector3.new(0.8,0.8,0.8),
Color3.fromRGB(255,200,200),
model
)
mouth.CFrame = head.CFrame * CFrame.new(0,0,-1.4)
Weld(mouth, head)
--========================================================
-- 9. 腹の膨らみ(BellySphere)
--========================================================
local belly = CreatePart(
"BellySphere",
Enum.PartType.Ball,
Vector3.new(1.5,1.5,1.5),
Color3.fromRGB(255,130,130),
model
)
belly.CFrame = body.CFrame * CFrame.new(0,-1.2,0.3)
Weld(belly, body)
--========================================================
-- 完成
--========================================================
print("Demekin model generated.")
🎯 このコードの特徴(靖の OS 視点)
✔ Part の意味構造が明確
- BodySphere
- HeadSphere
- TailBase
- TailFin
- Eyes
- Fins
すべて「意味のある部品」として命名。
✔ WeldConstraint のみで構造を固定
- Joint の破綻がない
- Massless で水中挙動が安定
✔ 色・マテリアル変更が容易
プレイヤーが色を変える仕様に対応しやすい。
✔ 後で AI や操作システムを追加しやすい
- Movement
- Eat
- Digest
- Poop
- Weak
- Dead
すべてこのモデルに後付け可能。
🎣 次に進むべきステップ
このモデルが生成できたら、次はどれを作る?
- プレイヤー出目金の操作システム(Movement Controller)
- 餌を食べる処理(Eat)
- 内部タイマー(空腹・消化・排糞)ModuleScript
- 天敵昆虫 AI(追跡・吸血)
- 死亡アニメーション(腹上・白目・浮上)
どれを進める?