Someone told me to do it like this:
script.Parent.Touched:connect(function() script.Parent.Script.Disabled = true for index,p in pairs(script.Parent.Parent.Truck:GetChildren()) do for i = 1,200 do p.Position = p.Position + Vector3.new(.4,0,0) end wait(.1) end end)
That didn't work. It teleported the blocks one by one. When I tried this before that, it moved them slowly, but still one by one.
script.Parent.Touched:connect(function() script.Parent.Script.Disabled = true for index,p in pairs(script.Parent.Parent.Truck:GetChildren()) do for i = 1,200 do p.Position = p.Position + Vector3.new(.4,0,0) wait(.1) end end end)
Instead, use MoveTo()
object = game.Workspace.Truck object:MoveTo(Vector3.new(0, 0, 0)) -- This is how you would use the "MoveTo" method
MoveTo() is helpful when moving an entire model to another place. It would move the model and all of its children at the same time.
Try this:
script.Parent.Touched:connect(function() script.Parent.Script.Disabled = true script.Parent.Parent.Truck:MoveTo(Vector3.new(0, 0, 0)) --Put down a position you want it to go. end)
Let me know if it works! :)
EDIT: An example of how you could move in increments.
x = 0 y = 0 z = 0 object = game.Workspace.Part for i = 0, 100, 1 do object:MoveTo(Vector3.new(x, y, z)) x = x + .4 end
That is just an example. What you may want to do will take more work. I feel if you fumble around with things, you will get it done :)
Good luck!