made changes and added more transitions
feel free to use this, all you gotta do is put it in a module script and load it using require
It offers functions such as:
A. Fade Transition - Fades one UI all the way out before fading the 2nd in
Usage:
module.FadeTransition(First UI, Second UI, TweenInfo)
B. Fade and Move Transition - Fades one UI all the way out before fading the 2nd in but also moves the UI out to the side. moveAmount can be negative to move one direction or positive to move the other.
Usage:
module.Fade_And_Move_Transition(First UI, Second UI, TweenInfo, moveAmount)
C. Fade and Move Transition Horiz - Same thing except on the Y axis instead of X
Usage:
module.Fade_And_Move_Transition_Horiz(First UI, Second UI, TweenInfo, moveAmount)
D. MoveLeft- Moves the UI to the Left and has the new UI come in from the other side
Usage:
module.MoveLeft(First UI, Second UI, TweenInfo)
E. Move Right - Moves the UI to the Right and has the new UI come in from the other side
Usage:
module.MoveRight(First UI, Second UI, TweenInfo)
F. Mixed fade - Fades out the first UI and in the right UI
Usage:
module.MixFade(First UI, Second UI, TweenInfo)
G. Mix Fade Move - Same thing as Fade and Move but with a mixed fade
Usage:
module.MixFadeMove(First UI, Second UI, TweenInfo, moveAmount)
H. Mix Fade Move Horiz - Same thing as previous, except horizontal
Usage:
module.MixFadeMoveHoriz(First UI, Second UI, TweenInfo, moveAmount)
I. No Transition - No transition, just changes them to visible and not visible.
Usage:
module.NoTrans(First UI, Second UI)
Script:
--[[
_____ __
/ < /___ ___ _____/ /____ _____
__ / // / __ `__ \/ ___/ __/ _ \/ ___/
/ /_/ // / / / / / (__ ) /_/ __/ /
\____//_/_/ /_/ /_/____/\__/\___/_/
User-Interface Transition Module
VERSION 1.0.0
]]
local Transitions = {}
local ObjectPropertyTable = {}
local _TweenInfo = nil
local function GetTableFromInstance(Instance)
for index, item in ObjectPropertyTable do
if item[1]==Instance then
return item
end
end
warn("No table found for " .. Instance:GetFullName() .. ". Returning default")
return {Instance, {Transparency = 0}, _TweenInfo}
end
function Transitions.FadeTransition(UI1, UI2, TweenInf)
_TweenInfo = TweenInf
local UI1ToChange = {UI1}
for index, object in UI1:GetDescendants() do table.insert(UI1ToChange, object) end
if UI2 then
UI2ToChange = {UI2}
for index, object in UI2:GetDescendants() do table.insert(UI2ToChange, object) end
end
for index, object in ObjectPropertyTable do game["TweenService"]:Create(object[1], object[3], object[2]):Play() end
ObjectPropertyTable = {}
if true then
UI2.Visible = false
UI1.Visible = true
for index, object in UI1ToChange do
if object:IsA("Frame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {BackgroundTransparency = 1}):Play()
end
if object:IsA("TextLabel") or object:IsA("TextButton") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], TextTransparency = object["TextTransparency"], TextStrokeTransparency = object["TextStrokeTransparency"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {BackgroundTransparency = 1, TextTransparency = 1, TextStrokeTransparency = 1}):Play()
end
if object:IsA("TextBox") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], TextTransparency = object["TextTransparency"], TextStrokeTransparency = object["TextStrokeTransparency"], PlaceholderColor3 = object["PlaceholderColor3"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {BackgroundTransparency = 1, TextTransparency = 1, TextStrokeTransparency = 1, PlaceholderColor3 = Color3.fromRGB()}):Play()
end
if object:IsA("ImageLabel") or object:IsA("ImageButton") or object:IsA("ViewportFrame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], ImageTransparency = object["ImageTransparency"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {BackgroundTransparency = 1, ImageTransparency = 1}):Play()
end
if object:IsA("UIStroke") then
table.insert(ObjectPropertyTable, {
object,
{Transparency = object["Transparency"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {Transparency = 1}):Play()
end
if object:IsA("ScrollingFrame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], ScrollBarImageTransparency = object["ScrollBarImageTransparency"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {BackgroundTransparency = 1, ScrollBarImageTransparency = 1}):Play()
end
if object:IsA("VideoFrame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {BackgroundTransparency = 1}):Play()
end
end
wait(TweenInf["Time"])
UI2.Visible = true
UI1.Visible = false
if UI2ToChange then
for index, object in UI2ToChange do
if object:IsA("Frame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"]},
TweenInf
})
object.BackgroundTransparency = 1
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
if object:IsA("TextLabel") or object:IsA("TextButton") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], TextTransparency = object["TextTransparency"], TextStrokeTransparency = object["TextStrokeTransparency"]},
TweenInf
})
object.BackgroundTransparency = 1
object.TextTransparency = 1
object.TextStrokeTransparency = 1
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
if object:IsA("TextBox") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], TextTransparency = object["TextTransparency"], TextStrokeTransparency = object["TextStrokeTransparency"], PlaceholderColor3 = object["PlaceholderColor3"]},
TweenInf
})
object.BackgroundTransparency = 1
object.TextTransparency = 1
object.TextStrokeTransparency = 1
object.PlaceholderColor3 = Color3.fromRGB()
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
if object:IsA("ImageLabel") or object:IsA("ImageButton") or object:IsA("ViewportFrame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], ImageTransparency = object["ImageTransparency"]},
TweenInf
})
object.BackgroundTransparency = 1
object.ImageTransparency = 1
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
if object:IsA("UIStroke") then
table.insert(ObjectPropertyTable, {
object,
{Transparency = object["Transparency"]},
TweenInf
})
object.Transparency = 1
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
if object:IsA("VideoFrame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"]},
TweenInf
})
object.BackgroundTransparency = 1
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
if object:IsA("ScrollingFrame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], ScrollBarImageTransparency = object["ScrollBarImageTransparency"]},
TweenInf
})
object.BackgroundTransparency = 1
object.ScrollBarImageTransparency = 1
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
end
for index, object in UI1ToChange do
if (
object:IsA("Frame") or
object:IsA("TextLabel") or
object:IsA("TextButton") or
object:IsA("ImageLabel") or
object:IsA("ImageButton") or
object:IsA("ViewportFrame") or
object:IsA("UIStroke") or
object:IsA("ScrollingFrame") or
object:IsA("VideoFrame")
)
then
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
end
end
wait(TweenInf["Time"])
end
end
function Transitions.Fade_And_Move_Transition(UI1, UI2, TweenInf, moveAmount)
_TweenInfo = TweenInf
local UI1ToChange = {UI1}
local settings = {
["UI1_MOVETO"] = UI1.Position.X.Offset-moveAmount,
["UI2_MOVEFROM"] = UI2.Position.X.Offset+moveAmount,
["UI1_MOVEFROM"] = UI1.Position.X.Offset,
["UI2_MOVETO"] = UI2.Position.X.Offset
}
for index, object in UI1:GetDescendants() do table.insert(UI1ToChange, object) end
if UI2~=nil then
UI2ToChange = {UI2}
for index, object in UI2:GetDescendants() do table.insert(UI2ToChange, object) end
end
for index, object in ObjectPropertyTable do game["TweenService"]:Create(object[1], object[3], object[2]):Play() end
ObjectPropertyTable = {}
if true then
UI2.Visible = false
UI1.Visible = true
game["TweenService"]:Create(UI1, TweenInf, {Position = UDim2.new(UI1.Position.X.Scale, settings["UI1_MOVETO"], UI1.Position.Y.Scale, UI1.Position.Y.Offset)}):Play()
UI2.Position = UDim2.new(UI2.Position.X.Scale, settings["UI2_MOVEFROM"], UI2.Position.Y.Scale, UI2.Position.Y.Offset)
for index, object in UI1ToChange do
if object:IsA("Frame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {BackgroundTransparency = 1}):Play()
end
if object:IsA("TextLabel") or object:IsA("TextButton") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], TextTransparency = object["TextTransparency"], TextStrokeTransparency = object["TextStrokeTransparency"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {BackgroundTransparency = 1, TextTransparency = 1, TextStrokeTransparency = 1}):Play()
end
if object:IsA("TextBox") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], TextTransparency = object["TextTransparency"], TextStrokeTransparency = object["TextStrokeTransparency"], PlaceholderColor3 = object["PlaceholderColor3"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {BackgroundTransparency = 1, TextTransparency = 1, TextStrokeTransparency = 1, PlaceholderColor3 = Color3.fromRGB()}):Play()
end
if object:IsA("ImageLabel") or object:IsA("ImageButton") or object:IsA("ViewportFrame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], ImageTransparency = object["ImageTransparency"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {BackgroundTransparency = 1, ImageTransparency = 1}):Play()
end
if object:IsA("UIStroke") then
table.insert(ObjectPropertyTable, {
object,
{Transparency = object["Transparency"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {Transparency = 1}):Play()
end
if object:IsA("ScrollingFrame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], ScrollBarImageTransparency = object["ScrollBarImageTransparency"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {BackgroundTransparency = 1, ScrollBarImageTransparency = 1}):Play()
end
if object:IsA("VideoFrame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {BackgroundTransparency = 1}):Play()
end
end
wait(TweenInf["Time"])
UI2.Visible = true
UI1.Visible = false
game["TweenService"]:Create(UI2, TweenInf, {Position = UDim2.new(UI2.Position.X.Scale, settings["UI2_MOVETO"], UI2.Position.Y.Scale, UI2.Position.Y.Offset)}):Play()
UI1.Position = UDim2.new(UI1.Position.X.Scale, settings["UI1_MOVEFROM"], UI1.Position.Y.Scale, UI1.Position.Y.Offset)
if UI2ToChange then
for index, object in UI2ToChange do
if object:IsA("Frame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"]},
TweenInf
})
object.BackgroundTransparency = 1
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
if object:IsA("TextLabel") or object:IsA("TextButton") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], TextTransparency = object["TextTransparency"], TextStrokeTransparency = object["TextStrokeTransparency"]},
TweenInf
})
object.BackgroundTransparency = 1
object.TextTransparency = 1
object.TextStrokeTransparency = 1
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
if object:IsA("TextBox") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], TextTransparency = object["TextTransparency"], TextStrokeTransparency = object["TextStrokeTransparency"], PlaceholderColor3 = object["PlaceholderColor3"]},
TweenInf
})
object.BackgroundTransparency = 1
object.TextTransparency = 1
object.TextStrokeTransparency = 1
object.PlaceholderColor3 = Color3.fromRGB()
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
if object:IsA("ImageLabel") or object:IsA("ImageButton") or object:IsA("ViewportFrame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], ImageTransparency = object["ImageTransparency"]},
TweenInf
})
object.BackgroundTransparency = 1
object.ImageTransparency = 1
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
if object:IsA("UIStroke") then
table.insert(ObjectPropertyTable, {
object,
{Transparency = object["Transparency"]},
TweenInf
})
object.Transparency = 1
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
if object:IsA("VideoFrame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"]},
TweenInf
})
object.BackgroundTransparency = 1
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
if object:IsA("ScrollingFrame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], ScrollBarImageTransparency = object["ScrollBarImageTransparency"]},
TweenInf
})
object.BackgroundTransparency = 1
object.ScrollBarImageTransparency = 1
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
end
for index, object in UI1ToChange do
if (
object:IsA("Frame") or
object:IsA("TextLabel") or
object:IsA("TextButton") or
object:IsA("ImageLabel") or
object:IsA("ImageButton") or
object:IsA("ViewportFrame") or
object:IsA("UIStroke") or
object:IsA("ScrollingFrame") or
object:IsA("VideoFrame")
)
then
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
end
end
end
end
function Transitions.Fade_And_Move_Transition_Horiz(UI1, UI2, TweenInf, moveAmount)
_TweenInfo = TweenInf
local UI1ToChange = {UI1}
local settings = {
["UI1_MOVETO"] = UI1.Position.Y.Offset-moveAmount,
["UI2_MOVEFROM"] = UI2.Position.Y.Offset+moveAmount,
["UI1_MOVEFROM"] = UI1.Position.Y.Offset,
["UI2_MOVETO"] = UI2.Position.Y.Offset
}
for index, object in UI1:GetDescendants() do table.insert(UI1ToChange, object) end
if UI2~=nil then
UI2ToChange = {UI2}
for index, object in UI2:GetDescendants() do table.insert(UI2ToChange, object) end
end
for index, object in ObjectPropertyTable do game["TweenService"]:Create(object[1], object[3], object[2]):Play() end
ObjectPropertyTable = {}
if true then
UI2.Visible = false
UI1.Visible = true
game["TweenService"]:Create(UI1, TweenInf, {Position = UDim2.new(UI2.Position.X.Scale, settings["UI1_MOVETO"], UI2.Position.Y.Scale, UI2.Position.Y.Offset)}):Play()
UI2.Position = UDim2.new(UI2.Position.X.Scale, settings["UI2_MOVEFROM"], UI2.Position.Y.Scale, UI2.Position.Y.Offset)
for index, object in UI1ToChange do
if object:IsA("Frame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {BackgroundTransparency = 1}):Play()
end
if object:IsA("TextLabel") or object:IsA("TextButton") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], TextTransparency = object["TextTransparency"], TextStrokeTransparency = object["TextStrokeTransparency"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {BackgroundTransparency = 1, TextTransparency = 1, TextStrokeTransparency = 1}):Play()
end
if object:IsA("TextBox") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], TextTransparency = object["TextTransparency"], TextStrokeTransparency = object["TextStrokeTransparency"], PlaceholderColor3 = object["PlaceholderColor3"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {BackgroundTransparency = 1, TextTransparency = 1, TextStrokeTransparency = 1, PlaceholderColor3 = Color3.fromRGB()}):Play()
end
if object:IsA("ImageLabel") or object:IsA("ImageButton") or object:IsA("ViewportFrame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], ImageTransparency = object["ImageTransparency"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {BackgroundTransparency = 1, ImageTransparency = 1}):Play()
end
if object:IsA("UIStroke") then
table.insert(ObjectPropertyTable, {
object,
{Transparency = object["Transparency"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {Transparency = 1}):Play()
end
if object:IsA("ScrollingFrame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], ScrollBarImageTransparency = object["ScrollBarImageTransparency"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {BackgroundTransparency = 1, ScrollBarImageTransparency = 1}):Play()
end
if object:IsA("VideoFrame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {BackgroundTransparency = 1}):Play()
end
end
wait(TweenInf["Time"])
UI2.Visible = true
UI1.Visible = false
game["TweenService"]:Create(UI2, TweenInf, {Position = UDim2.new(UI2.Position.X.Scale, UI2.Position.X.Offset, UI2.Position.Y.Scale,settings["UI2_MOVETO"] )}):Play()
UI1.Position = UDim2.new(UI1.Position.X.Scale, UI1.Position.X.Offset, UI1.Position.Y.Scale, settings["UI1_MOVEFROM"])
if UI2ToChange then
for index, object in UI2ToChange do
if object:IsA("Frame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"]},
TweenInf
})
object.BackgroundTransparency = 1
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
if object:IsA("TextLabel") or object:IsA("TextButton") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], TextTransparency = object["TextTransparency"], TextStrokeTransparency = object["TextStrokeTransparency"]},
TweenInf
})
object.BackgroundTransparency = 1
object.TextTransparency = 1
object.TextStrokeTransparency = 1
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
if object:IsA("TextBox") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], TextTransparency = object["TextTransparency"], TextStrokeTransparency = object["TextStrokeTransparency"], PlaceholderColor3 = object["PlaceholderColor3"]},
TweenInf
})
object.BackgroundTransparency = 1
object.TextTransparency = 1
object.TextStrokeTransparency = 1
object.PlaceholderColor3 = Color3.fromRGB()
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
if object:IsA("ImageLabel") or object:IsA("ImageButton") or object:IsA("ViewportFrame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], ImageTransparency = object["ImageTransparency"]},
TweenInf
})
object.BackgroundTransparency = 1
object.ImageTransparency = 1
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
if object:IsA("UIStroke") then
table.insert(ObjectPropertyTable, {
object,
{Transparency = object["Transparency"]},
TweenInf
})
object.Transparency = 1
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
if object:IsA("VideoFrame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"]},
TweenInf
})
object.BackgroundTransparency = 1
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
if object:IsA("ScrollingFrame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], ScrollBarImageTransparency = object["ScrollBarImageTransparency"]},
TweenInf
})
object.BackgroundTransparency = 1
object.ScrollBarImageTransparency = 1
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
end
for index, object in UI1ToChange do
if (
object:IsA("Frame") or
object:IsA("TextLabel") or
object:IsA("TextButton") or
object:IsA("ImageLabel") or
object:IsA("ImageButton") or
object:IsA("ViewportFrame") or
object:IsA("UIStroke") or
object:IsA("ScrollingFrame") or
object:IsA("VideoFrame")
)
then
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
end
end
end
end
function Transitions.MoveLeft(UI1, UI2, TweenInf)
_TweenInfo = TweenInf
local NEWPOS = UI1.Position
UI1.Visible = true
UI2.Visible = false
UI2.Position = UDim2.new(
UI1.Position.X.Scale - UI1.Size.X.Scale,
UI1.Position.X.Offset - UI1.Size.X.Offset,
UI1.Position.Y.Scale,
UI1.Position.Y.Offset
)
UI2.Visible = true
game.TweenService:Create(UI1, TweenInf, {
Position = UDim2.new(
UI1.Position.X.Scale + UI1.Size.X.Scale,
UI1.Position.X.Offset + UI1.Size.X.Offset,
UI1.Position.Y.Scale,
UI1.Position.Y.Offset
)
}):Play()
game.TweenService:Create(UI2, TweenInf, {
Position = UDim2.new(
UI1.Position.X.Scale,
UI1.Position.X.Offset,
UI1.Position.Y.Scale,
UI1.Position.Y.Offset
)
}):Play()
wait(TweenInf["Time"])
UI1.Visible = false
UI1.Position = NEWPOS
end
function Transitions.MoveRight(UI1, UI2, TweenInf)
_TweenInfo = TweenInf
local NEWPOS = UI1.Position
UI1.Visible = true
UI2.Visible = false
UI2.Position = UDim2.new(
UI1.Position.X.Scale + UI1.Size.X.Scale,
UI1.Position.X.Offset + UI1.Size.X.Offset,
UI1.Position.Y.Scale,
UI1.Position.Y.Offset
)
UI2.Visible = true
game.TweenService:Create(UI1, TweenInf, {
Position = UDim2.new(
UI1.Position.X.Scale - UI1.Size.X.Scale,
UI1.Position.X.Offset - UI1.Size.X.Offset,
UI1.Position.Y.Scale,
UI1.Position.Y.Offset
)
}):Play()
game.TweenService:Create(UI2, TweenInf, {
Position = UDim2.new(
UI1.Position.X.Scale,
UI1.Position.X.Offset,
UI1.Position.Y.Scale,
UI1.Position.Y.Offset
)
}):Play()
wait(TweenInf["Time"])
UI1.Visible = false
UI1.Position = NEWPOS
end
function Transitions.MixFade(UI1, UI2, TweenInf)
_TweenInfo = TweenInf
local UI1ToChange = {UI1}
for index, object in UI1:GetDescendants() do table.insert(UI1ToChange, object) end
if UI2 then
UI2ToChange = {UI2}
for index, object in UI2:GetDescendants() do table.insert(UI2ToChange, object) end
end
for index, object in ObjectPropertyTable do game["TweenService"]:Create(object[1], object[3], object[2]):Play() end
ObjectPropertyTable = {}
if true then
UI2.Visible = false
UI1.Visible = true
for index, object in UI1ToChange do
if object:IsA("Frame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {BackgroundTransparency = 1}):Play()
end
if object:IsA("TextLabel") or object:IsA("TextButton") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], TextTransparency = object["TextTransparency"], TextStrokeTransparency = object["TextStrokeTransparency"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {BackgroundTransparency = 1, TextTransparency = 1, TextStrokeTransparency = 1}):Play()
end
if object:IsA("TextBox") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], TextTransparency = object["TextTransparency"], TextStrokeTransparency = object["TextStrokeTransparency"], PlaceholderColor3 = object["PlaceholderColor3"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {BackgroundTransparency = 1, TextTransparency = 1, TextStrokeTransparency = 1, PlaceholderColor3 = Color3.fromRGB()}):Play()
end
if object:IsA("ImageLabel") or object:IsA("ImageButton") or object:IsA("ViewportFrame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], ImageTransparency = object["ImageTransparency"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {BackgroundTransparency = 1, ImageTransparency = 1}):Play()
end
if object:IsA("UIStroke") then
table.insert(ObjectPropertyTable, {
object,
{Transparency = object["Transparency"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {Transparency = 1}):Play()
end
if object:IsA("ScrollingFrame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], ScrollBarImageTransparency = object["ScrollBarImageTransparency"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {BackgroundTransparency = 1, ScrollBarImageTransparency = 1}):Play()
end
if object:IsA("VideoFrame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {BackgroundTransparency = 1}):Play()
end
end
UI2.Visible = true
if UI2ToChange then
for index, object in UI2ToChange do
if object:IsA("Frame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"]},
TweenInf
})
object.BackgroundTransparency = 1
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
if object:IsA("TextLabel") or object:IsA("TextButton") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], TextTransparency = object["TextTransparency"], TextStrokeTransparency = object["TextStrokeTransparency"]},
TweenInf
})
object.BackgroundTransparency = 1
object.TextTransparency = 1
object.TextStrokeTransparency = 1
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
if object:IsA("TextBox") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], TextTransparency = object["TextTransparency"], TextStrokeTransparency = object["TextStrokeTransparency"], PlaceholderColor3 = object["PlaceholderColor3"]},
TweenInf
})
object.BackgroundTransparency = 1
object.TextTransparency = 1
object.TextStrokeTransparency = 1
object.PlaceholderColor3 = Color3.fromRGB()
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
if object:IsA("ImageLabel") or object:IsA("ImageButton") or object:IsA("ViewportFrame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], ImageTransparency = object["ImageTransparency"]},
TweenInf
})
object.BackgroundTransparency = 1
object.ImageTransparency = 1
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
if object:IsA("UIStroke") then
table.insert(ObjectPropertyTable, {
object,
{Transparency = object["Transparency"]},
TweenInf
})
object.Transparency = 1
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
if object:IsA("VideoFrame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"]},
TweenInf
})
object.BackgroundTransparency = 1
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
if object:IsA("ScrollingFrame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], ScrollBarImageTransparency = object["ScrollBarImageTransparency"]},
TweenInf
})
object.BackgroundTransparency = 1
object.ScrollBarImageTransparency = 1
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
end
wait(TweenInf["Time"])
UI1.Visible = false
for index, object in UI1ToChange do
if (
object:IsA("Frame") or
object:IsA("TextLabel") or
object:IsA("TextButton") or
object:IsA("ImageLabel") or
object:IsA("ImageButton") or
object:IsA("ViewportFrame") or
object:IsA("UIStroke") or
object:IsA("ScrollingFrame") or
object:IsA("VideoFrame")
)
then
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
end
end
wait(TweenInf["Time"])
end
end
function Transitions.MixFadeMove(UI1, UI2, TweenInf, moveAmount)
_TweenInfo = TweenInf
local UI1ToChange = {UI1}
local settings = {
["UI1_MOVETO"] = UI1.Position.X.Offset-moveAmount,
["UI2_MOVEFROM"] = UI2.Position.X.Offset+moveAmount,
["UI1_MOVEFROM"] = UI1.Position.X.Offset,
["UI2_MOVETO"] = UI2.Position.X.Offset
}
for index, object in UI1:GetDescendants() do table.insert(UI1ToChange, object) end
if UI2~=nil then
UI2ToChange = {UI2}
for index, object in UI2:GetDescendants() do table.insert(UI2ToChange, object) end
end
for index, object in ObjectPropertyTable do game["TweenService"]:Create(object[1], object[3], object[2]):Play() end
ObjectPropertyTable = {}
if true then
UI2.Visible = false
UI1.Visible = true
game["TweenService"]:Create(UI1, TweenInf, {Position = UDim2.new(UI1.Position.X.Scale, settings["UI1_MOVETO"], UI1.Position.Y.Scale, UI1.Position.Y.Offset)}):Play()
UI2.Position = UDim2.new(UI2.Position.X.Scale, settings["UI2_MOVEFROM"], UI2.Position.Y.Scale, UI2.Position.Y.Offset)
for index, object in UI1ToChange do
if object:IsA("Frame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {BackgroundTransparency = 1}):Play()
end
if object:IsA("TextLabel") or object:IsA("TextButton") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], TextTransparency = object["TextTransparency"], TextStrokeTransparency = object["TextStrokeTransparency"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {BackgroundTransparency = 1, TextTransparency = 1, TextStrokeTransparency = 1}):Play()
end
if object:IsA("TextBox") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], TextTransparency = object["TextTransparency"], TextStrokeTransparency = object["TextStrokeTransparency"], PlaceholderColor3 = object["PlaceholderColor3"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {BackgroundTransparency = 1, TextTransparency = 1, TextStrokeTransparency = 1, PlaceholderColor3 = Color3.fromRGB()}):Play()
end
if object:IsA("ImageLabel") or object:IsA("ImageButton") or object:IsA("ViewportFrame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], ImageTransparency = object["ImageTransparency"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {BackgroundTransparency = 1, ImageTransparency = 1}):Play()
end
if object:IsA("UIStroke") then
table.insert(ObjectPropertyTable, {
object,
{Transparency = object["Transparency"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {Transparency = 1}):Play()
end
if object:IsA("ScrollingFrame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], ScrollBarImageTransparency = object["ScrollBarImageTransparency"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {BackgroundTransparency = 1, ScrollBarImageTransparency = 1}):Play()
end
if object:IsA("VideoFrame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {BackgroundTransparency = 1}):Play()
end
end
game["TweenService"]:Create(UI2, TweenInf, {Position = UDim2.new(UI2.Position.X.Scale, settings["UI2_MOVETO"], UI2.Position.Y.Scale, UI2.Position.Y.Offset)}):Play()
UI2.Visible = true
if UI2ToChange then
for index, object in UI2ToChange do
if object:IsA("Frame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"]},
TweenInf
})
object.BackgroundTransparency = 1
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
if object:IsA("TextLabel") or object:IsA("TextButton") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], TextTransparency = object["TextTransparency"], TextStrokeTransparency = object["TextStrokeTransparency"]},
TweenInf
})
object.BackgroundTransparency = 1
object.TextTransparency = 1
object.TextStrokeTransparency = 1
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
if object:IsA("TextBox") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], TextTransparency = object["TextTransparency"], TextStrokeTransparency = object["TextStrokeTransparency"], PlaceholderColor3 = object["PlaceholderColor3"]},
TweenInf
})
object.BackgroundTransparency = 1
object.TextTransparency = 1
object.TextStrokeTransparency = 1
object.PlaceholderColor3 = Color3.fromRGB()
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
if object:IsA("ImageLabel") or object:IsA("ImageButton") or object:IsA("ViewportFrame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], ImageTransparency = object["ImageTransparency"]},
TweenInf
})
object.BackgroundTransparency = 1
object.ImageTransparency = 1
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
if object:IsA("UIStroke") then
table.insert(ObjectPropertyTable, {
object,
{Transparency = object["Transparency"]},
TweenInf
})
object.Transparency = 1
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
if object:IsA("VideoFrame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"]},
TweenInf
})
object.BackgroundTransparency = 1
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
if object:IsA("ScrollingFrame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], ScrollBarImageTransparency = object["ScrollBarImageTransparency"]},
TweenInf
})
object.BackgroundTransparency = 1
object.ScrollBarImageTransparency = 1
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
end
end
wait(TweenInf["Time"])
UI1.Visible = false
UI1.Position = UDim2.new(UI1.Position.X.Scale, settings["UI1_MOVEFROM"], UI1.Position.Y.Scale, UI1.Position.Y.Offset)
for index, object in UI1ToChange do
if (
object:IsA("Frame") or
object:IsA("TextLabel") or
object:IsA("TextButton") or
object:IsA("ImageLabel") or
object:IsA("ImageButton") or
object:IsA("ViewportFrame") or
object:IsA("UIStroke") or
object:IsA("ScrollingFrame") or
object:IsA("VideoFrame")
)
then
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
end
end
end
function Transitions.MixFadeMoveHoriz(UI1, UI2, TweenInf, moveAmount)
_TweenInfo = TweenInf
local UI1ToChange = {UI1}
local settings = {
["UI1_MOVETO"] = UI1.Position.Y.Offset-moveAmount,
["UI2_MOVEFROM"] = UI2.Position.Y.Offset+moveAmount,
["UI1_MOVEFROM"] = UI1.Position.Y.Offset,
["UI2_MOVETO"] = UI2.Position.Y.Offset
}
for index, object in UI1:GetDescendants() do table.insert(UI1ToChange, object) end
if UI2~=nil then
UI2ToChange = {UI2}
for index, object in UI2:GetDescendants() do table.insert(UI2ToChange, object) end
end
for index, object in ObjectPropertyTable do game["TweenService"]:Create(object[1], object[3], object[2]):Play() end
ObjectPropertyTable = {}
if true then
UI2.Visible = false
UI1.Visible = true
game["TweenService"]:Create(UI1, TweenInf, {Position = UDim2.new(UI1.Position.X.Scale, UI1.Position.X.Offset, UI1.Position.Y.Scale,settings["UI1_MOVETO"])}):Play()
UI2.Position = UDim2.new(UI2.Position.X.Scale, UI2.Position.X.Offset, UI2.Position.Y.Scale, settings["UI2_MOVEFROM"])
for index, object in UI1ToChange do
if object:IsA("Frame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {BackgroundTransparency = 1}):Play()
end
if object:IsA("TextLabel") or object:IsA("TextButton") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], TextTransparency = object["TextTransparency"], TextStrokeTransparency = object["TextStrokeTransparency"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {BackgroundTransparency = 1, TextTransparency = 1, TextStrokeTransparency = 1}):Play()
end
if object:IsA("TextBox") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], TextTransparency = object["TextTransparency"], TextStrokeTransparency = object["TextStrokeTransparency"], PlaceholderColor3 = object["PlaceholderColor3"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {BackgroundTransparency = 1, TextTransparency = 1, TextStrokeTransparency = 1, PlaceholderColor3 = Color3.fromRGB()}):Play()
end
if object:IsA("ImageLabel") or object:IsA("ImageButton") or object:IsA("ViewportFrame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], ImageTransparency = object["ImageTransparency"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {BackgroundTransparency = 1, ImageTransparency = 1}):Play()
end
if object:IsA("UIStroke") then
table.insert(ObjectPropertyTable, {
object,
{Transparency = object["Transparency"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {Transparency = 1}):Play()
end
if object:IsA("ScrollingFrame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], ScrollBarImageTransparency = object["ScrollBarImageTransparency"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {BackgroundTransparency = 1, ScrollBarImageTransparency = 1}):Play()
end
if object:IsA("VideoFrame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"]},
TweenInf
})
game["TweenService"]:Create(object, TweenInf, {BackgroundTransparency = 1}):Play()
end
end
UI2.Visible = true
game["TweenService"]:Create(UI2, TweenInf, {Position = UDim2.new(UI2.Position.X.Scale, UI2.Position.X.Offset, UI2.Position.Y.Scale, settings["UI2_MOVETO"])}):Play()
UI1.Position = UDim2.new(UI1.Position.X.Scale, UI1.Position.X.Offset, UI1.Position.Y.Scale, settings["UI1_MOVEFROM"])
if UI2ToChange then
for index, object in UI2ToChange do
if object:IsA("Frame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"]},
TweenInf
})
object.BackgroundTransparency = 1
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
if object:IsA("TextLabel") or object:IsA("TextButton") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], TextTransparency = object["TextTransparency"], TextStrokeTransparency = object["TextStrokeTransparency"]},
TweenInf
})
object.BackgroundTransparency = 1
object.TextTransparency = 1
object.TextStrokeTransparency = 1
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
if object:IsA("TextBox") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], TextTransparency = object["TextTransparency"], TextStrokeTransparency = object["TextStrokeTransparency"], PlaceholderColor3 = object["PlaceholderColor3"]},
TweenInf
})
object.BackgroundTransparency = 1
object.TextTransparency = 1
object.TextStrokeTransparency = 1
object.PlaceholderColor3 = Color3.fromRGB()
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
if object:IsA("ImageLabel") or object:IsA("ImageButton") or object:IsA("ViewportFrame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], ImageTransparency = object["ImageTransparency"]},
TweenInf
})
object.BackgroundTransparency = 1
object.ImageTransparency = 1
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
if object:IsA("UIStroke") then
table.insert(ObjectPropertyTable, {
object,
{Transparency = object["Transparency"]},
TweenInf
})
object.Transparency = 1
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
if object:IsA("VideoFrame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"]},
TweenInf
})
object.BackgroundTransparency = 1
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
if object:IsA("ScrollingFrame") then
table.insert(ObjectPropertyTable, {
object,
{BackgroundTransparency = object["BackgroundTransparency"], ScrollBarImageTransparency = object["ScrollBarImageTransparency"]},
TweenInf
})
object.BackgroundTransparency = 1
object.ScrollBarImageTransparency = 1
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
end
end
wait(TweenInf["Time"])
UI1.Visible = false
for index, object in UI1ToChange do
if (
object:IsA("Frame") or
object:IsA("TextLabel") or
object:IsA("TextButton") or
object:IsA("ImageLabel") or
object:IsA("ImageButton") or
object:IsA("ViewportFrame") or
object:IsA("UIStroke") or
object:IsA("ScrollingFrame") or
object:IsA("VideoFrame")
)
then
game["TweenService"]:Create(object, TweenInf, GetTableFromInstance(object)[2]):Play()
end
end
end
end
function Transitions.NoTrans(UI1, UI2)
UI1.Visible = false
if UI2~=nil then
UI2.Visible = true
end
end
return Transitions