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

How do I get a model's position?

Asked by 9 years ago

I need to clone a model and move it to another part of a place, and after a given amount of time, move the model back to its original position. Unfortunately, I don't know the coordinates of the models starting position, so I can't move it back there. Doing something like this:

print(game.Workspace.Model.Position)

will give an error because models don't have a position property. I know there must be some way to get it, because using the :moveTo() method moves the center of a model to a given point, so does anyone know how?

2 answers

Log in to vote
2
Answered by 9 years ago

One way to do this would be to set a PrimaryPart of the model.

local Model = Game.ServerStorage.Thing
Model.PrimaryPart = Model.PrimaryPartThing
local NewPosition = CFrame.new(12312,31231231,3123112)


local OldPosition = Model:GetPrimaryPartCFrame()
Model:SetPrimaryPartCFrame(NewPosition)

wait(312312)

Model:SetPrimaryPartCFrame(OldPosition)
Ad
Log in to vote
2
Answered by 9 years ago

you can also put an invisible block with the same x,y size values and set it to that...

Answer this question