I’m trying to make my GUI fade out and then another GUI fade in. I can get the GUI to fade out, however I cannot get the GUI I need to fade in.
local frame = script.Parent
local LOGO = script.Parent.LOGO
local Stu = script.Parent.Studios
local TITLE = game:WaitForChild("StarterGui").TitleScreen
local TEXTS = TITLE.Menu.TextButton
local MAFIA = TITLE.Menu.Mafia
local sound = game:GetService("StarterGui").TitleScreen.Menu["Audio/MafiaTown"]
local MENU = game:WaitForChild("StarterGui").TitleScreen.Menu
game:WaitForChild(MENU)
wait(5)
for i = 0,100 do
LOGO.ImageTransparency += 0.01
Stu.TextTransparency += 0.01
frame.Transparency += 0.01
MENU.BackgroundTransparency += 0.00
wait(0.01)
end
wait(2)
for i = 0,1 do
TEXTS.TextTransparency += 0
MAFIA.TextTransparency += 0
sound:Play()
sound.Looped = true
end
TEXTS.MouseButton1Click:Connect(function()
for i = 1,100 do
TEXTS.TextTransparency += 0.01
MAFIA.TextTransparency += 0.01
MENU.Transparency += 0.01
end
sound:Destroy()
TITLE:Destroy()
script.Parent:Destroy()
end)
This is the script I have. What I got so far is the one GUI to fade out and then when the “text button” is clicked it locks to a part. (The camera locks to the part.) I’m still very new to scripting so I’m probably missing something extremely simple.
If its all of them, you should set their Transparencies to 1 then do “-=” then add a wait function.
Also, this for loop isn’t very smooth. You should consider using a TweenService. Since you’re new to scripting, I can help you with it.
This helped a lot! It’s now functioning the way I need it to thank you! Only problem now is that the camera randomly stopped working lol
local frame = script.Parent
local RunService = game:GetService("RunService")
local LOGO = script.Parent.LOGO
local Stu = script.Parent.Studios
local players = game:GetService("Players").LocalPlayer
players.PlayerGui:WaitForChild("TitleScreen")
local TITLE = players.PlayerGui.TitleScreen
local cc = workspace.CurrentCamera
local PART = workspace.CAM2
local TEXTS = TITLE.Menu.TextButton
local MAFIA = TITLE.Menu.Mafia
local sound = game:GetService("StarterGui").TitleScreen.Menu["Audio/MafiaTown"]
local MENU = TITLE.Menu
local isOn = false
game:WaitForChild(MENU)
wait(5)
for i = 0,100 do
LOGO.ImageTransparency += 0.01
Stu.TextTransparency += 0.01
MENU.BackgroundTransparency -= 0.00
wait(0.01)
end
wait(2)
for i = 0,1 do
TEXTS.TextTransparency -= 1
MAFIA.TextTransparency -= 1
MENU.BackgroundTransparency -= 1
sound:Play()
sound.Looped = true
end
TEXTS.MouseButton1Click:Connect(function()
for i = 1,100 do
TEXTS.TextTransparency += 0
MAFIA.TextTransparency += 0
MENU.BackgroundTransparency += 0
end
wait()
if not isOn then
cc.CameraType = Enum.CameraType.Scriptable
isOn = true
else
cc.CameraType = Enum.CameraType.Custom
isOn = false
end
sound:Destroy()
TITLE:Destroy()
script.Parent:Destroy()
end)
RunService.RenderStepped:Connect(function()
if isOn then
cc.CFrame = PART.CFrame
end
end)
I’m not sure if they are allowed to look around the part, but this this should fix your problem.
I have put the camera code into the button, but if needed you can move it back into the renderStepped loop.
TEXTS.MouseButton1Click:Connect(function()
for i = 1,100 do
TEXTS.TextTransparency += 0
MAFIA.TextTransparency += 0
MENU.BackgroundTransparency += 0
end
wait()
if not isOn then
cc.CameraSubject = PART
wait()
cc.CameraType = Enum.CameraType.Scriptable -- Remove if player is allowed to zoom/look around the view part.
isOn = true
else
cc.CameraSubject = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
wait()
cc.CameraType = Enum.CameraType.Custom -- Remove if player is allowed to zoom/look around the view part.
isOn = false
end
sound:Destroy()
TITLE:Destroy()
script.Parent:Destroy()
end)