#how do i make two tween run at once

3 messages · Page 1 of 1 (latest)

pine flax
#

i am trying to make both of these tweens for pulling up an update log and tweening the button away work, but they just go one after eachother. how do i make them both go at once?

#

here is full code :

local xbutton = script.Parent


local invisbutton = script.Parent.Parent.Parent.Parent.UpdateLog.InvisButton
local border = invisbutton.Parent
local updframe = border.Parent.Parent.Menu.menusinmenus.updatelogframe
local optinvisbutton = border.Parent.options.InvisButton
local ts = game:GetService("TweenService")
local clickti = TweenInfo.new(
    1.5, Enum.EasingStyle.Back, Enum.EasingDirection.InOut,0,false,0
)
local goal = {
    Position = border.Position + UDim2.new(0.275,0,0,0)
}

local logshowupti = TweenInfo.new(
    2, Enum.EasingStyle.Back, Enum.EasingDirection.InOut,0,false,0
)
local goal2 = {
    Position = updframe.Position + UDim2.new(0,0,2,0)
}


local clicktween2 = ts:Create(updframe, logshowupti, goal2)
local clicktween = ts:Create(border, clickti, goal)


local function closeupd()
    updframe.Active = false
    clicktween2:Play()
    xbutton.Interactable = false
    task.wait(2)
    updframe.Position = UDim2.new(0.4,0,-0.9,0)
    xbutton.Interactable = true
end
local function closebutton()
    clicktween:Play()
    invisbutton.Interactable = false
    task.wait(1.5)
    invisbutton.Interactable = true
end

xbutton.MouseButton1Click:Connect(function()
    
    closeupd()
    closebutton()
end)
optinvisbutton.MouseButton1Click:Connect(function()
    if updframe.Active == true then
        closeupd()
        closebutton()
    end
end)
#

it plays the first tween, waits for it to finish, then the second tween. how do i make them play at the same time?