学ぶ
エンジンクラス
Model

*このコンテンツは、ベータ版のAI(人工知能)を使用して翻訳されており、エラーが含まれている可能性があります。このページを英語で表示するには、 こちら をクリックしてください。


概要
方法
AddPersistentPlayer(playerInstance: Player):()
BreakJoints():()
非推奨
breakJoints():()
非推奨
GetModelSize():Vector3
非推奨
MakeJoints():()
非推奨
makeJoints():()
非推奨
move(location: Vector3):()
非推奨
MoveTo(position: Vector3):()
moveTo(location: Vector3):()
非推奨
RemovePersistentPlayer(playerInstance: Player):()
ScaleTo(newScaleFactor: number):()
SetIdentityOrientation():()
非推奨
SetPrimaryPartCFrame(cframe: CFrame):()
非推奨
TranslateBy(delta: Vector3):()
継承されたメンバー
コードサンプル
基本モデルインスタンス
local function groupObjects(objectTable)
local model = Instance.new("Model")
for _, object in pairs(objectTable) do
object.Parent = model
end
return model
end
local objects = {
Instance.new("Part"),
Instance.new("Part"),
}
groupObjects(objects)

APIリファレンス
プロパティ
LevelOfDetail
プラグインのセキュリティ
並列読み取り
Model.LevelOfDetail:Enum.ModelLevelOfDetail

ModelStreamingMode
並列読み取り
Model.ModelStreamingMode:Enum.ModelStreamingMode

PrimaryPart
並列読み取り
Model.PrimaryPart:BasePart
コードサンプル
サイコロを投げる
-- サイコロモデルを2つの半分で作成し、それらを接続します
local diceModel = Instance.new("Model")
diceModel.Name = "ChanceCube"
local diceTop = Instance.new("Part")
diceTop.Size = Vector3.new(4, 2, 4)
diceTop.Position = Vector3.new(0, 1, 0)
diceTop.Color = Color3.new(0, 0, 1)
diceTop.Parent = diceModel
local diceBottom = diceTop:Clone()
diceBottom.Position = Vector3.new(0, -1, 0)
diceBottom.Color = Color3.new(1, 0, 0)
diceBottom.Parent = diceModel
local weld = Instance.new("WeldConstraint")
weld.Part0 = diceTop
weld.Part1 = diceBottom
weld.Parent = diceModel
-- 作業領域の原点の上にサイコロを持ち上げます(プライマリパートは不要です)
diceModel.Parent = workspace
diceModel:PivotTo(CFrame.new(0, 10, 0))
-- 物理シミュレーションの前にプライマリパートを割り当てます
-- この行がないと、スクリプトは常に同じことを出力し、モデルのバウンディングボックスの向きは変わりません
diceModel.PrimaryPart = diceTop
-- サイコロを転がす前に少し待ちます(床に落ち着くのを待ちます)
for i = 5, 1, -1 do
print("サイコロを転がします...", i)
task.wait(1)
end
diceTop:ApplyAngularImpulse(Vector3.new(15000, 1000, 5000))
diceTop:ApplyImpulse(Vector3.new(0, 3000, 0))
task.wait(1)
-- ロールが完了するのを待ちます
while diceTop.AssemblyLinearVelocity.Magnitude > 0.1 or diceTop.AssemblyAngularVelocity.Magnitude > 0.1 do
task.wait()
end
-- プライマリパートの影響を受けたサイコロの向きを取得します
local orientation = diceModel:GetBoundingBox()
if orientation.YVector.Y > 0.5 then
print("やった!")
else
print("お母さんです!")
end

Scale
複製されていません
スクリプト作成できません
並列読み取り
Model.Scale:number

WorldPivot
複製されていません
並列読み取り
Model.WorldPivot:CFrame
コードサンプル
ピボットをリセット
local function resetPivot(model)
local boundsCFrame = model:GetBoundingBox()
if model.PrimaryPart then
model.PrimaryPart.PivotOffset = model.PrimaryPart.CFrame:ToObjectSpace(boundsCFrame)
else
model.WorldPivot = boundsCFrame
end
end
resetPivot(script.Parent)

方法
AddPersistentPlayer
Model:AddPersistentPlayer(playerInstance:Player):()
パラメータ
playerInstance:Player
既定値: "nil"
戻り値
()

BreakJoints
非推奨

breakJoints
非推奨

GetBoundingBox
Model:GetBoundingBox():Tuple
戻り値

GetExtentsSize
Model:GetExtentsSize():Vector3
戻り値
コードサンプル
モデルの GetExtentsSize
local model = Instance.new("Model")
model.Parent = workspace
local RNG = Random.new()
for _ = 1, 5 do
local part = Instance.new("Part")
part.Anchored = true
part.Size = Vector3.new(RNG:NextNumber(0.05, 5), RNG:NextNumber(0.05, 5), RNG:NextNumber(0.05, 5))
part.Parent = model
end
print(model:GetExtentsSize())

GetModelCFrame
非推奨

GetModelSize
非推奨

GetPersistentPlayers
Model:GetPersistentPlayers():{Player}
戻り値

GetPrimaryPartCFrame
非推奨

GetScale
シミュレーションへのアクセス
Model:GetScale():number
戻り値
コードサンプル
PivotToおよびScaleToを使用して置き換えモデルを差し込む
local CollectionService = game:GetService("CollectionService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
-- 置き換えたいタグを持つすべてのモデルを見つける
local items = CollectionService:GetTagged("Tree")
local newModel = ReplicatedStorage.FancyTreeReplacementModel
for _, item in items do
-- 新しいアイテムを作成し、古いものの位置でスケール/配置する
local newItem = newModel:Clone()
newItem:ScaleTo(item:GetScale())
newItem:PivotTo(item:GetPivot())
-- 置き換えに同じタグを追加する
CollectionService:AddTag(newItem, "Tree")
-- 古いアイテムを削除し、新しいアイテムを親に設定する
newItem.Parent = item.Parent
item:Destroy()
end

MakeJoints
非推奨

makeJoints
非推奨

move
非推奨

MoveTo
Model:MoveTo(position:Vector3):()
パラメータ
position:Vector3
戻り値
()
コードサンプル
モデル移動
local START_POSITION = Vector3.new(-20, 10, 0)
local END_POSITION = Vector3.new(0, 10, 0)
local model = Instance.new("Model")
model.Parent = workspace
local part1 = Instance.new("Part")
part1.Size = Vector3.new(4, 4, 4)
part1.Position = START_POSITION
part1.Anchored = true
part1.BrickColor = BrickColor.new("Bright yellow")
part1.Parent = model
local part2 = Instance.new("Part")
part2.Size = Vector3.new(2, 2, 2)
part2.Position = START_POSITION + Vector3.new(0, 3, 0)
part2.Anchored = true
part2.BrickColor = BrickColor.new("Bright blue")
part2.Parent = model
model.PrimaryPart = part1
model.Parent = workspace
local obstruction = Instance.new("Part")
obstruction.Name = "Obstruction"
obstruction.Size = Vector3.new(10, 10, 10)
obstruction.Position = Vector3.new(0, 10, 0)
obstruction.Anchored = true
obstruction.BrickColor = BrickColor.new("Bright green")
obstruction.Parent = workspace
task.wait(3)
model:MoveTo(END_POSITION)

moveTo
非推奨

RemovePersistentPlayer
Model:RemovePersistentPlayer(playerInstance:Player):()
パラメータ
playerInstance:Player
既定値: "nil"
戻り値
()

ResetOrientationToIdentity
非推奨

ScaleTo
Model:ScaleTo(newScaleFactor:number):()
パラメータ
newScaleFactor:number
戻り値
()

SetIdentityOrientation
非推奨

SetPrimaryPartCFrame
非推奨

TranslateBy
Model:TranslateBy(delta:Vector3):()
パラメータ
delta:Vector3
戻り値
()
コードサンプル
モデル TranslateBy
local START_POSITION = Vector3.new(-20, 10, 0)
local END_POSITION = Vector3.new(0, 10, 0)
local model = Instance.new("Model")
local part1 = Instance.new("Part")
part1.Size = Vector3.new(4, 4, 4)
part1.CFrame = CFrame.new(START_POSITION) * CFrame.Angles(0, math.rad(45), 0)
part1.Anchored = true
part1.BrickColor = BrickColor.new("明るい黄色")
part1.Parent = model
local part2 = Instance.new("Part")
part2.Size = Vector3.new(2, 2, 2)
part2.CFrame = part1.CFrame * CFrame.new(0, 3, 0)
part2.Anchored = true
part2.BrickColor = BrickColor.new("明るい青")
part2.Parent = model
model.PrimaryPart = part1
model.Parent = workspace
local obstruction = Instance.new("Part")
obstruction.Name = "障害物"
obstruction.Size = Vector3.new(10, 10, 10)
obstruction.Position = Vector3.new(0, 10, 0)
obstruction.Transparency = 0.5
obstruction.Anchored = true
obstruction.BrickColor = BrickColor.new("明るい緑")
obstruction.Parent = workspace
task.wait(3)
-- TranslateByを使用してモデルを障害物の中に移動する
model:TranslateBy(END_POSITION - START_POSITION)

©2026 Roblox Corporation。Roblox(ロブロックス)、RobloxロゴおよびPowering Imaginationは、米国並びにその他の国における登録商標および非登録商標です。