How do I get the current position of the Egg. The Egg is a model. I want to move it as a whole from where it is in the present
--minecraft dragon egg
bounce = true
function teleportEgg()
if bounce == true then
bounce = false
x1 = math.random(-25, 25)
y1 = math.random(-1, 1)
z1 = math.random(-25, 25)
script.Parent.Parent:MoveTo()
wait(0.1)
bounce = true
end
end
script.Parent.ClickDetector.MouseClick:Connect(teleportEgg)
Use the TranslateBy function. "Shifts a Model by a given Vector3 offset" I believe this is exactly what you're describing. Note that if any object is in the way of its position, "the Model will overlap said object" An alternative option is to use the MoveTo function, and add the current position of the model (Model.PrimaryPart) with an offset as its argument.
Model:MoveTo( Model.PrimaryPart.Position + Vector3.new(0, 1, 0) ) --moves this model up by 1 stud from its current position.
If you use MoveTo instead of TranslateBy, the differences are as follows: "the model will be moved up in the Y direction until there is nothing in the way" and "the rotation is not preserved when moving a model"