Help to make a tween star while another is still playing

how can i make tween be able to play while tween 1 is still playing?
and vice versa

local img = script.Parent.Parent.Frame
local ts = game:GetService("TweenService")

local TI = TweenInfo.new(.2,Enum.EasingStyle.Linear, Enum.EasingDirection.InOut,0,false,-1)

local Tween = ts:Create(img, TI, {Position = UDim2.new(0.5, 0,-1, 0)})
local Tween1 = ts:Create(img, TI, {Position = UDim2.new(0.5, 0,0.5, 0)})


script.Parent.MouseButton1Click:Connect(function()

	Tween1:Play()





end)	
1 Like

I’m pretty sure that Tween1:Play() does not yield, so you should just be able to add Tween:Play() after Tween1:Play()

1 Like

They might be asking about how they would go about tweening a tween on the same thing which is not possible due to the fact that TweenService will respect the tween until it is done before playing another

1 Like

Tweens run in their own thread of execution, so playing one tween will not delay the playing of another (unless you attempt to tween the same properties of a single instance in two or more tweens).

1 Like

that just make the frame stay at it’s current position

1 Like

ues i mean like that because if you do it with mouse enter and mouse leave the second tween start by stopping the other one but i don’t know how to do it with mousebutton1click

1 Like

You could make a toggle type thing? Check if a bool is true, if not do the opposite like hiding the UI?

local img = script.Parent.Parent.Frame
local ts = game:GetService("TweenService")

local TI = TweenInfo.new(.2,Enum.EasingStyle.Linear, Enum.EasingDirection.InOut,0,false,-1)

local Tween = ts:Create(img, TI, {Position = UDim2.new(0.5, 0,-1, 0)})
local Tween1 = ts:Create(img, TI, {Position = UDim2.new(0.5, 0,0.5, 0)})

local tr = true

script.Parent.MouseButton1Click:Connect(function()

	if tr then 
		Tween1:Play()
		tr = false
	else if not tr then
			Tween:Play()
			tr= true
		end
	end

end)	

it works thank you very much!!


for anyone wandering this is what it looks like

local button = script.Parent
local img = button.Parent.Frame

local tweenService = game:GetService("TweenService")

local tweenInfo = TweenInfo.new(.2,Enum.EasingStyle.Linear, Enum.EasingDirection.InOut,0,false,-1)

local tween = nil
local goal = nil
local toggle = false

button.MouseButton1Click:Connect(function()
	if tween then
		tween:Cancel()
		tween = nil
	end
	
	goal = if toggle then {Position = UDim2.fromScale(0.5, -1)} else {Position = UDim2.fromScale(0.5, 0.5)}
	tween = tweenService:Create(img, tweenInfo, goal)
	tween:Play()
end)

You may want to use In or Out for the EasingDirection.

If the topic is solved, you should mark a solution so others know what the solution was. I’m not quite clear on who solved this but mark who helped you so others know. Thanks