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

How to prevent tweens starting at the same time to send players at 0,0,0?

Asked by 2 years ago

So i'm trying to make two tweens work at the same time , the tweens works fine when i press play but send players at 0,0,0 when triggered with the button on team play

local TweenService = game:GetService("TweenService") --gets service for tween
local tweenPart = game.Workspace.ASCEND 
local tweenPart2 = game.Workspace.ASCEND2

local info = TweenInfo.new(
    1,          
    Enum.EasingStyle.Bounce,     
    Enum.EasingDirection.Out,   
    0,                    --times repeated 
    false,                 --reverse
    0                      --delay time     
)

local Goals = {          
    Position = Vector3.new(-218.749, 3.825, 87.465), --where the part will be after tween
    Orientation = Vector3.new(-90, 0, 0) 
}


local Goals2 = {
    Position = Vector3.new(-218.749, 3.825, 80.361),
    Orientation = Vector3.new(90, 0, 0)
}

local GoalsBack2 = {
Position = Vector3.new(-218.749, 5.825, 82.361),
Orientation = Vector3.new(0, 0, 0)
}


local GoalsBack = {
Position = Vector3.new(-218.749, 5.825, 85.465),
Orientation = Vector3.new(0, 0, 0)
}


local PartTween = TweenService:Create(tweenPart, info, Goals) --gets all the info and goals and creates tween
local PartTweenBack = TweenService:Create(tweenPart, info, GoalsBack)
local PartTween2 = TweenService:Create(tweenPart2, info, Goals2)
local PartTweenBack2 = TweenService:Create(tweenPart2, info, GoalsBack2)


pressed = false
function onClicked()
    if pressed == false then
        pressed = true
        PartTween:Play()
        PartTween2:Play()
        wait(3)
        PartTweenBack:Play()
        PartTweenBack2:Play()
        wait(1)
        pressed = false

    else
        print(pressed)
    end


end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

Answer this question