GetModelCFrame (Method): Difference between revisions
From Legacy Roblox Wiki
Jump to navigationJump to search
>ArceusInator New page: {{Method |name=GetModelCFrame |returns=CFrame ''modelCFrame'' |description=The Model's CFrame Position. |object=Model}}Category:Methods |
m Text replacement - "<SyntaxHighlight code="lua">" to "<syntaxhighlight lang="lua">" |
||
(8 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
{{Method | <onlyinclude>{{Method | ||
|name=GetModelCFrame | |name=GetModelCFrame | ||
|returns=[[CFrame]] | |returns=[[CFrame]] | ||
|description= | |description= Returns the model's [[CFrame]] [[Position]]. | ||
|object=Model}}[[Category:Methods]] | |object=Model}} | ||
</onlyinclude> | |||
{{clear floats}} | |||
{{Example| | |||
This code would create a model, put some parts in it, position them randomly, and then print its position: | |||
<syntaxhighlight lang="lua"> | |||
local model = Instance.new('Model', Workspace) -- Create a model. | |||
for i = 1, 5 do | |||
-- Fill the model with randomly positioned parts. | |||
local part = Instance.new('Part', model) | |||
part.Anchored = true | |||
part.Position = Vector3.new(math.random(5), math.random(5), math.random(5)) | |||
end | |||
print(model:GetModelCFrame()) | |||
</syntaxhighlight> | |||
The output may vary depending on the position of the parts. | |||
}} | |||
[[Category:Methods]] |
Latest revision as of 06:16, 27 April 2023
GetModelCFrame( ) | |
Returns | CFrame |
Description: | Returns the model's CFrame Position. |
Member of: | Model |
Example
This code would create a model, put some parts in it, position them randomly, and then print its position:
local model = Instance.new('Model', Workspace) -- Create a model.
for i = 1, 5 do
-- Fill the model with randomly positioned parts.
local part = Instance.new('Part', model)
part.Anchored = true
part.Position = Vector3.new(math.random(5), math.random(5), math.random(5))
end
print(model:GetModelCFrame())
The output may vary depending on the position of the parts.