배우기
엔진 클래스
Model

*이 콘텐츠는 AI(베타)를 사용해 번역되었으며, 오류가 있을 수 있습니다. 이 페이지를 영어로 보려면 여기를 클릭하세요.


요약
메서드
AddPersistentPlayer(playerInstance: Player):()
BreakJoints():()
사용되지 않음
breakJoints():()
사용되지 않음
GetModelCFrame():CFrame
사용되지 않음
GetModelSize():Vector3
사용되지 않음
GetPrimaryPartCFrame():CFrame
사용되지 않음
MakeJoints():()
사용되지 않음
makeJoints():()
사용되지 않음
move(location: Vector3):()
사용되지 않음
MoveTo(position: Vector3):()
moveTo(location: Vector3):()
사용되지 않음
RemovePersistentPlayer(playerInstance: Player):()
ResetOrientationToIdentity():()
사용되지 않음
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
코드 샘플
주사위 던지기
-- 두 개의 절반으로 주사위 모델을 생성하고 서로 연결합니다.
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)
월드 피벗
local Workspace = game:GetService("Workspace")
local bluePart = Instance.new("Part")
bluePart.Name = "BluePart"
bluePart.Parent = Workspace
local redPart = Instance.new("Part")
redPart.Name = "RedPart"
redPart.Parent = Workspace
local model = Instance.new("Model")
Workspace.BluePart.Parent = model
Workspace.RedPart.Parent = model
model.Parent = Workspace
print(model:GetPivot()) -- 현재 "BluePart"와 "RedPart"를 포함하는 경계 상자의 중심과 같습니다.
model:PivotTo(CFrame.new(0, 10, 0)) -- "model.WorldPivot"를 명시적으로 설정할 필요 없이 작동합니다.

메서드
AddPersistentPlayer
Model:AddPersistentPlayer(playerInstance:Player):()
매개 변수
playerInstance:Player
기본값: "nil"
반환
()

BreakJoints
사용되지 않음

breakJoints
사용되지 않음

GetBoundingBox
Model:GetBoundingBox():Tuple
반환
코드 샘플
경계 상자 가져오기
local Workspace = game:GetService("Workspace")
local model = Workspace.Model
local part = Workspace.Part
local orientation, size = model:GetBoundingBox()
-- 모델의 경계 상자에 맞게 파트를 크기 조정하고 위치 설정
part.Size = size
part.CFrame = orientation

GetExtentsSize
Model:GetExtentsSize():Vector3
반환
코드 샘플
모델 크기 가져오기
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
반환
()
코드 샘플
모델 이동하기
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'은 미국 및 기타 국가 내 당사의 등록 및 미등록 상표입니다.