This script is inside a click detector inside a model. But it is not working. It is anchored so parts wont fall out of the model. Im not sure if this should be in a local script or a regular one either.
local Model = Workspace.Model
local newPos = Model.Position + Vector3.new(0,5,0)
local Time = 10
local Increment = 0.5
local Debounce = false
local Diff = newPos - Model.Position
local Mag = Diff.magnitude
local Direction = CFrame.new(Model.Position, newPos).lookVector
function MovePart()
if Debounce then return end
Debounce = true
for n = 0, Mag, Increment do
Model.CFrame = Model.CFrame + (Direction * Increment)
wait( (Time/Mag) * Increment )
end
Debounce = false
end
Workspace.Button.ClickDetector.MouseClick:connect(MoveModel)

3 comments
Don't you wish that models did though? sigh
^ Agreed. It would be SO much easier.
The problem is that it would be unpredictable in many cases. Be thankful we have SetPrimaryPartCFrame, now. You used to have to move each part using Lua math, which is a lot slower.