I want to make it so when the player clicks on the text button, the play button would disappear slowly and then the loading bar appears and once it has completely loaded then the visible GUI would disappear and a new one would appear.
When I attempt to test this in-game it doesn’t work. I even implemented for it to print a message to show if it has been pressed or not but it doesn’t print anything at all meaning that there must be an error.
I’ve tried to fix it and check for any errors but did not find any. Already looked for solutions and didn’t find any either.
Well I’m not sure if the tweening works or not and I can’t tell because it’s supposed to print that the button has been pressed if it has bene pressed but it’s not even doing that so there is no way to tell.
Please, please PLEASE refrain from sending screenshots of code. We
a) cannot see it clearly and need to zoom in
b) cannot copy-paste the code
c) cannot quote certain parts of the code
d) cannot manipulate parts of the code and send it back to you.
Instead, paste your code and surround it a line of three backticks above and below your code.
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local MainGUI = LocalPlayer.PlayerGui:WaitForChild("Main")
local CharacterSelectionGUI = LocalPlayer.PlayerGui:WaitForChild("CharacterSelection")
local MainFrame = MainGUI:WaitForChild("Background")
local PlayButton = MainFrame:WaitForChild("PlayButton")
local TweenModule = require(game.ReplicatedStorage.Tween)
local TweenService = game:GetService("TweenService")
PlayButton.Activated:Connect(function()
print("The play button has been pressed.")
for i,Button in pairs(LocalPlayer.PlayerGui.Main.Background:GetDescendants()) do
if Button:IsA("TextButton") then
if Button.Name ~= "PlayButton" then
TweenModule:GetTweenObject(Button,TweenInfo.new(1.5,Enum.EasingStyle.Quad),{Visible = false}):QueuePlay()
end
end
end
wait(1.5)
for i,Images in pairs(LocalPlayer.PlayerGui.Main.Background:GetDescendants()) do
if Images:IsA("ImageLabel") then
if Images.Name ~= "MainBar" or Images.Name ~= "BarHolder" or Images.Name ~= "Bar" then
TweenModule:GetTweenObject(Images,TweenInfo.new(0.1,Enum.EasingStyle.Quad),{Visible = true}):QueuePlay()
end
end
end
for i,Text in pairs(LocalPlayer.PlayerGui.Main.Background.MainBar.BarHolder:GetDescendants()) do
if Text:IsA("TextLabel") then
if Text.Name ~= "Text" then
TweenModule:GetTweenObject(Text,TweenInfo.new(0.1,Enum.EasingStyle.Quad),{Visible = true}):QueuePlay()
end
end
end
for i,BarImage in pairs(LocalPlayer.PlayerGui.Main.Background.MainBar.BarHolder:GetDescendants()) do
if BarImage:IsA("ImageLabel") then
if BarImage.Name ~= "Bar" then
TweenModule:GetTweenObject(BarImage,TweenInfo.new(10,Enum.EasingStyle.Quad),{Size = 0, 490,0, 80}):QueuePlay()
end
end
end
wait(10)
MainGUI.Enabled = false
CharacterSelectionGUI.Enabled = true
end)
what happened to the indentation this looks even more demonic
here is the way easier to read version
local Players = game:GetService(“Players”)
local LocalPlayer = Players.LocalPlayer
local MainGUI = LocalPlayer.PlayerGui:WaitForChild(“Main”)
local CharacterSelectionGUI = LocalPlayer.PlayerGui:WaitForChild(“CharacterSelection”)
local MainFrame = MainGUI:WaitForChild(“Background”)
local PlayButton = MainFrame:WaitForChild(“PlayButton”)
local TweenModule = require(game.ReplicatedStorage.Tween)
local TweenService = game:GetService(“TweenService”)
PlayButton.Activated:Connect(function()
print(“The play button has been pressed.”)
for i,Button in pairs(LocalPlayer.PlayerGui.Main.Background:GetDescendants()) do
if Button:IsA(“TextButton”) then
if Button.Name ~= “PlayButton” then
TweenModule:GetTweenObject(Button,TweenInfo.new(1.5,Enum.EasingStyle.Quad),{Visible = false}):QueuePlay()
end
end
end
wait(1.5)
for i,Images in pairs(LocalPlayer.PlayerGui.Main.Background:GetDescendants()) do
if Images:IsA(“ImageLabel”) then
if Images.Name ~= “MainBar” or Images.Name ~= “BarHolder” or Images.Name ~= “Bar” then
TweenModule:GetTweenObject(Images,TweenInfo.new(0.1,Enum.EasingStyle.Quad),{Visible = true}):QueuePlay()
end
end
end
for i,Text in pairs(LocalPlayer.PlayerGui.Main.Background.MainBar.BarHolder:GetDescendants()) do
if Text:IsA(“TextLabel”) then
if Text.Name ~= “Text” then
TweenModule:GetTweenObject(Text,TweenInfo.new(0.1,Enum.EasingStyle.Quad),{Visible = true}):QueuePlay()
end
end
end
for i,BarImage in pairs(LocalPlayer.PlayerGui.Main.Background.MainBar.BarHolder:GetDescendants()) do
if BarImage:IsA(“ImageLabel”) then
if BarImage.Name ~= “Bar” then
TweenModule:GetTweenObject(BarImage,TweenInfo.new(10,Enum.EasingStyle.Quad),{Size = 0, 490,0, 80}):QueuePlay()
end
end
end
wait(10)
MainGUI.Enabled = false
CharacterSelectionGUI.Enabled = true
end)