Im trying to get these tweens to play at the same time but right now they are playing separately from the for loop that calls the OpenPage function. How can i get them to play at the same time?
local function tweenLeft(ui)
local y = ui.Position.Y.Scale
local x = ui.Position.X.Scale
ActiveTweens[ui.Name] = x
local ti = TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0)
TweenService:Create(ui, ti, {
Position = UDim2.new(1, 0, y, 0)
}):Play()
end
local function tweenRevert(ui)
local y = ui.Position.Y.Scale
local prevPos = ActiveTweens[ui.Name]
local ti = TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0)
TweenService:Create(ui, ti, {
Position = UDim2.new(prevPos, 0, y, 0)
}):Play()
end
local function OpenPage(frameToOpen)
for i,v in pairs(script.Parent.BackgroundFrame.MenuFrame:GetChildren()) do
if v:IsA("ImageButton") or v.Name == "Patch" or v.Name == "Updates" then
tweenLeft(v)
end
end
end
local function ClosePage(frameToClose)
for i,v in pairs(script.Parent.BackgroundFrame.MenuFrame:GetChildren()) do
if v:IsA("ImageButton") then
tweenRevert(v)
end
end
end