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

How do I move an object to another object?

I tried doing this but this didn't work

local placelocation = game.Workspace.Nets.Ballspawn.CFrame
      Part.CFrame = CFrame.new(placelocation)

1 comment

0

are you trying to move a part or model?

1 answer

The constructor CFrame.new() needs a Vector3 position for it to create a new CFrame. Your error is placing a CFrame inside of it which isn't a Vector3.

You do have methods for setting position and rotations like this:

local location = workspace.Ballspawn.CFrame --This is the CFrame only

--We get the first 3 values (POS values) of the CFrame like this
Part.CFrame = CFrame.new(location.Position) --Vector3 inside of a .new()

--We can also just stick with the variable since it's a CFrame
Part.CFrame = location --Setting a CFrame to a CFrame

The difference to both examples is that the first wont keep the rotation of the location you're setting it to. That's because a CFrame is a matrix with the position and a rotation for an object.

You could just set the Part's position instead to do the same.

Note that the first 3 values to a CFrame are the (X, Y, Z) coordinates or the position of the CFrame

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