So I have a script for a UI that “Changes Pages” if you will. My problem with the script is it isn’t very efficient in the sense that in order to make sure that the right pages are being moved out of the way when the top icons are pressed. It’s a bit hard to explain in text, which is why I have a video down below.
Video
Script
local Home = script.Parent.PageButtons.HomeButton
local Teams = script.Parent.PageButtons.TeamsButton
local Settings = script.Parent.PageButtons.SettingsButton
local Credits = script.Parent.PageButtons.CreditsButton
local Shop = script.Parent.PageButtons.ShopButton
local Bar = script.Parent.PageButtons.Bar
local tweentime = 0.3
local HomeScreen = script.Parent.Home
local TeamScreen = script.Parent.Teams
local SettingsScreen = script.Parent.Settings
local CreditsScreen = script.Parent.Credits
local ShopScreen = script.Parent.Shop
Home.MouseButton1Click:Connect(function()
Home.TextColor3 = Color3.fromRGB(255, 136, 0)
Teams.TextColor3 = Color3.fromRGB(255, 255, 255)
Settings.TextColor3 = Color3.fromRGB(255, 255, 255)
Credits.TextColor3 = Color3.fromRGB(255, 255, 255)
Shop.TextColor3 = Color3.fromRGB(255, 255, 255)
Bar:TweenPosition(UDim2.new(0.182, 0, 0.075, 0), "InOut", "Quad", tweentime, false)
Bar:TweenSize(UDim2.new(0.06, 0, 0.005, 0), "InOut", "Quad", tweentime, false)
HomeScreen:TweenPosition(UDim2.new(0, 0, 0, 0), "InOut", "Quad", tweentime, false)
TeamScreen:TweenPosition(UDim2.new(-1, 0, 0, 0), "InOut", "Quad", tweentime, false)
SettingsScreen:TweenPosition(UDim2.new(-1, 0, 0, 0), "InOut", "Quad", tweentime, false)
ShopScreen:TweenPosition(UDim2.new(-1, 0, 0, 0), "InOut", "Quad", tweentime, false)
CreditsScreen:TweenPosition(UDim2.new(-1, 0, 0, 0), "InOut", "Quad", tweentime, false)
end)
Teams.MouseButton1Click:Connect(function()
Teams.TextColor3 = Color3.fromRGB(255, 136, 0)
Home.TextColor3 = Color3.fromRGB(255, 255, 255)
Settings.TextColor3 = Color3.fromRGB(255, 255, 255)
Credits.TextColor3 = Color3.fromRGB(255, 255, 255)
Shop.TextColor3 = Color3.fromRGB(255, 255, 255)
Bar:TweenPosition(UDim2.new(0.308, 0, 0.075, 0), "InOut", "Quad", tweentime ,false)
Bar:TweenSize(UDim2.new(0.06, 0, 0.005, 0), "InOut", "Quad", tweentime, false)
HomeScreen:TweenPosition(UDim2.new(-1, 0, 0, 0), "InOut", "Quad", tweentime, false)
TeamScreen:TweenPosition(UDim2.new(0, 0, 0, 0), "InOut", "Quad", tweentime, false)
HomeScreen:TweenPosition(UDim2.new(-1, 0, 0, 0), "InOut", "Quad", tweentime, false)
SettingsScreen:TweenPosition(UDim2.new(-1, 0, 0, 0), "InOut", "Quad", tweentime, false)
CreditsScreen:TweenPosition(UDim2.new(-1, 0, 0, 0), "InOut", "Quad", tweentime, false)
ShopScreen:TweenPosition(UDim2.new(-1, 0, 0, 0), "InOut", "Quad", tweentime, false)
end)
Settings.MouseButton1Click:Connect(function()
Settings.TextColor3 = Color3.fromRGB(255, 136, 0)
Home.TextColor3 = Color3.fromRGB(255, 255, 255)
Teams.TextColor3 = Color3.fromRGB(255, 255, 255)
Credits.TextColor3 = Color3.fromRGB(255, 255, 255)
Shop.TextColor3 = Color3.fromRGB(255, 255, 255)
Bar:TweenPosition(UDim2.new(0.432, 0, 0.075, 0),"InOut", "Quad", tweentime, false)
Bar:TweenSize(UDim2.new(0.076, 0, 0.005, 0),"InOut", "Quad", tweentime, false)
SettingsScreen:TweenPosition(UDim2.new(0, 0, 0, 0), "InOut", "Quad", tweentime, false)
HomeScreen:TweenPosition(UDim2.new(-1, 0, 0, 0), "InOut", "Quad", tweentime, false)
TeamScreen:TweenPosition(UDim2.new(-1, 0, 0, 0), "InOut", "Quad", tweentime, false)
CreditsScreen:TweenPosition(UDim2.new(-1, 0, 0, 0), "InOut", "Quad", tweentime, false)
ShopScreen:TweenPosition(UDim2.new(-1, 0, 0, 0), "InOut", "Quad", tweentime, false)
end)
Credits.MouseButton1Click:Connect(function()
Credits.TextColor3 = Color3.fromRGB(255, 136, 0)
Home.TextColor3 = Color3.fromRGB(255, 255, 255)
Teams.TextColor3 = Color3.fromRGB(255, 255, 255)
Settings.TextColor3 = Color3.fromRGB(255, 255, 255)
Shop.TextColor3 = Color3.fromRGB(255, 255, 255)
Bar:TweenPosition(UDim2.new(0.559, 0, 0.075, 0), "InOut", "Quad", tweentime, false)
Bar:TweenSize(UDim2.new(0.063, 0, 0.005, 0), "InOut", "Quad", tweentime, false)
CreditsScreen:TweenPosition(UDim2.new(0, 0, 0, 0), "InOut", "Quad", tweentime, false)
HomeScreen:TweenPosition(UDim2.new(-1, 0, 0, 0), "InOut", "Quad", tweentime, false)
ShopScreen:TweenPosition(UDim2.new(-1, 0, 0, 0), "InOut", "Quad", tweentime, false)
TeamScreen:TweenPosition(UDim2.new(-1, 0, 0, 0), "InOut", "Quad", tweentime, false)
SettingsScreen:TweenPosition(UDim2.new(-1, 0, 0, 0), "InOut", "Quad", tweentime, false)
end)
Shop.MouseButton1Click:Connect(function()
Shop.TextColor3 = Color3.fromRGB(255, 136, 0)
Home.TextColor3 = Color3.fromRGB(255, 255, 255)
Teams.TextColor3 = Color3.fromRGB(255, 255, 255)
Settings.TextColor3 = Color3.fromRGB(255, 255, 255)
Credits.TextColor3 = Color3.fromRGB(255, 255, 255)
Bar:TweenPosition(UDim2.new(0.691, 0, 0.075, 0), "InOut", "Quad", tweentime, false)
Bar:TweenSize(UDim2.new(0.049, 0, 0.005, 0), "InOut", "Quad", tweentime, false)
ShopScreen:TweenPosition(UDim2.new(0, 0, 0, 0), "InOut", "Quad", tweentime, false)
HomeScreen:TweenPosition(UDim2.new(-1, 0, 0, 0), "InOut", "Quad", tweentime, false)
CreditsScreen:TweenPosition(UDim2.new(-1, 0, 0, 0), "InOut", "Quad", tweentime, false)
SettingsScreen:TweenPosition(UDim2.new(-1, 0, 0, 0), "InOut", "Quad", tweentime, false)
TeamScreen:TweenPosition(UDim2.new(-1, 0, 0, 0), "InOut", "Quad", tweentime, false)
end)
GUI Model (If interested)
GUItest.rbxm (18.9 KB)