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

CFrame or Primary Part To Move Group?

Asked by 4 years ago

Ive been trying to figure out how i would move a group though a script. would i be using CFrame or Primary Part?

0
If it has a PrimaryPart you could use SetPrimaryPartCFrame mybituploads 304 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

There are several ways to do it, and moving it with the PrimaryPart requires CFrame. The other way is called the :MoveTo() function. It doesn't requite a PrimaryPart, but if you have one it will move it with the PrimaryPart, otherwise it will try to move the model using the root part.

(More info on :MoveTo()) https://developer.roblox.com/en-us/api-reference/function/Model/MoveTo

local Model = game.Workspace:WaitForChild("Model") --//You can just change "Model" with the name of your model

local Position = CFrame.new(0,50,0) --//Where we have the PrimaryPart to go

Model:SetPrimaryPartCFrame(Position) --//This is where we use the function :SetPrimaryPartCFrame() to set the CFrame of the PrimaryPart. It will move all members of the model relative to where you place the PrimaryPart.

We can do something similar with :MoveTo()

local Model = game.Workspace:WaitForChild("Model")

local Position = Vector3.new(0, 50, 0) --//MoveTo only accepts Vector3's

Model:MoveTo(Position) --//Moves the model

Those are the main ways to move a model, which one you use will depend on what you are doing.

Ad
Log in to vote
0
Answered by
IrishFix 124
4 years ago

If you are trying to get the things in a model to move you would do a loop, Look more for loops in the wiki and specifically for child loops,

Answer this question