Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

CFrame or Primary Part To Move Group?

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

1 comment

0

If it has a PrimaryPart you could use SetPrimaryPartCFrame

2 answers

✓ Accepted answer

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.

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,

This discussion is preserved as it was. New answers, comments, and votes are closed.