#Moving model (TweenService)

18 messages · Page 1 of 1 (latest)

west crown
#

Trying to move a model with TweenService but this script doesn't work. I don't want to do an action for every object in the model since there are a lot of them. how do i just make my model move from its position to the position of the other model "islandend"

local Prox = script.Parent

local TweenService = game:GetService("TweenService")

local Tweeninfo = TweenInfo.new(5, Enum.EasingStyle.Bounce, Enum.EasingDirection.Out)

local TweenToEnd = TweenService:Create(game.Workspace.Island, Tweeninfo, {Position = game.Workspace.Islandend.Position})
local TweenToEnd2 = TweenService:Create(game.Workspace.Island, Tweeninfo, {Orientation = game.Workspace.Islandend.Orientation})

Prox.Triggered:Connect(function()
    TweenToEnd:Play()
    TweenToEnd2:Play()
end)

note that this script works for individual parts, but not for models

willow oasis
#

Instead, tween the primary part of the model, and make sure all other parts in the model is welded to the primary part

west crown
#

that only moves the primary part

local Prox = script.Parent

local TweenService = game:GetService("TweenService")

local Tweeninfo = TweenInfo.new(5, Enum.EasingStyle.Bounce, Enum.EasingDirection.Out)

local TweenToEnd = TweenService:Create(game.Workspace.Island.MovingPart, Tweeninfo, {Position = game.Workspace.Islandend.MovingPart.Position})
local TweenToEnd2 = TweenService:Create(game.Workspace.Island.MovingPart, Tweeninfo, {Orientation = game.Workspace.Islandend.MovingPart.Orientation})

Prox.Triggered:Connect(function()
    TweenToEnd:Play()
    TweenToEnd2:Play()
end)
#

movingpart is the primary part

thick umbra
#

So they move with it

willow oasis
#

Exactly as i said

thick umbra
#

yep

west crown
#

Welded everything and anchored only the primary part

#

But it didn’t work

willow oasis
#

You’ve gotta weld everything to the primary part

#

You did that right?

west crown
#

using weldconstraints yes

#

do i need to use something different

dense nova
# west crown But it didn’t work

You are running both 2 tweens at the same time so try to use

local Prox = script.Parent

local TweenService = game:GetService("TweenService")

local Tweeninfo = TweenInfo.new(5, Enum.EasingStyle.Bounce, Enum.EasingDirection.Out)

local TweenToEnd = TweenService:Create(game.Workspace.Island.MovingPart, Tweeninfo, {Position = game.Workspace.Islandend.MovingPart.Position , Orientation = game.Workspace.Islandend.MovingPart.Orientation})


Prox.Triggered:Connect(function()
    TweenToEnd:Play()
  TweenToEnd.Completed:Connect(function()
    TweenToEnd2:Play()
  end)
end)
west crown