Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I position a model?

Asked by 9 years ago

Recently I've noticed how a model doesn't have a CFrame property yet they have a method;

model:GetModelCFrame()

And this made me rather confused so I was wondering how else I can position a part randomly.

http://wiki.roblox.com/index.php?title=GetModelCFrame

3 answers

Log in to vote
3
Answered by 9 years ago

There are 2 ways to position a model:

Model:MoveTo(Vector3)

Model:SetPrimaryPartCFrame(CFrame)

MoveTo(Vector3) This basically moves the model to the position specified in "Vector3". The good thing about this method is that the Model doesn't need to have a defined PrimaryPart. The bad thing about this method is that you can't rotate the model and you can't position the model within another model.

SetPrimaryPartCFrame(CFrame) This basically changes the CFrame of the model according to "CFrame". The good thing about this method is that you can position the model within other models and you can rotate it anyway you want. The bad thing about this method is that you need to have a PrimaryPart defined, and it doesn't CFrame the model based on the model's center, but rather based on the PrimaryPart's center.

Hope this helped!

0
Thanks! I have an NPC Model that I need to move about and such when cloning it through a while loop, will it be able to do that? (Goes to test :P) ZirutoHellfire 10 — 9y
0
If you want to move an NPC, I would suggest using :MoveTo() TurboFusion 1821 — 9y
0
I'm not moving it just placing it at random points like I'd do with a part, while wait() do x:Clone() x.Position = Vector3.new(randomX, randomY, randomZ) end ye it's not correct don't point it out it's quicker than typing it all but yea you get the gist :P ZirutoHellfire 10 — 9y
Ad
Log in to vote
0
Answered by
Thetacah 712 Moderation Voter
9 years ago

The way I would do this is indeed by using the MoveTo(Method)

Check it out on the roblox wiki:http://wiki.roblox.com/index.php?title=MoveTo_(Method)

Log in to vote
-2
Answered by 9 years ago

First there isnt a way to position a model like your doing. But... just use Roblox Tools to move the Model. Thats the only way it will work.

0
I never provided code to how I was positioning it? And GetModelCFrame is getting the Model's CFrame not setting it, I just can't find any way to position a model in my part/model generation code. ZirutoHellfire 10 — 9y

Answer this question