Problem: I would like to be able to enable another gui (a different one) once the operation is finished, but it does not activate, what am I doing wrong?
Current Gui: loading screen Another Gui: Play Gui screen
Project Organization:
(Important is marked in blue)
I just need to be able to enabled my other gui
localscript:
-- Required Modules
local guiSettings_Module =
require(game:WaitForChild("ReplicatedStorage"):WaitForChild("Modules"):FindFirstChild("Gui_Settings"));
-- My Variables.
local allPlayers = game:GetService("Players")
local localPlayer = game.Players.LocalPlayer
local playerGui = localPlayer.PlayerGui
local assetsToPreload = {workspace, playerGui}
local LoadScreen_Frame = script.Parent:FindFirstChild("Frame");
local Bar = LoadScreen_Frame:FindFirstChild("Bar");
local Inside_Bar = Bar:FindFirstChild("Inside_Bar");
-- Start loading
game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
LoadScreen_Frame.Visible = true
-- Resize to 10%
guiSettings_Module.ResizeBar(10, Inside_Bar);
-- Wait for the character to load and Resize to 40%
repeat wait() until localPlayer.Character ~= nil
guiSettings_Module.ResizeBar(40, Inside_Bar)
-- preload assets in the game
guiSettings_Module.preLoadAssets(assetsToPreload);
guiSettings_Module.ResizeBar(100, Inside_Bar);
-- Hide load screen
LoadScreen_Frame.TextLabel.Text = "LOADED!"
wait(1)
game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.All, true)
script.Parent:Destroy()
-- HELP HERE
game.StarterGui["PLAY GUI"].Enabled = true; -- this part dont work!
You destroy the parent of the script, which also destroys the script. Move the line before destroying the script’s parent.
-- Required Modules
local guiSettings_Module =
require(game:WaitForChild("ReplicatedStorage"):WaitForChild("Modules"):FindFirstChild("Gui_Settings"));
-- My Variables.
local allPlayers = game:GetService("Players")
local localPlayer = game.Players.LocalPlayer
local playerGui = localPlayer.PlayerGui
local assetsToPreload = {workspace, playerGui}
local LoadScreen_Frame = script.Parent:FindFirstChild("Frame");
local Bar = LoadScreen_Frame:FindFirstChild("Bar");
local Inside_Bar = Bar:FindFirstChild("Inside_Bar");
-- Start loading
game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
LoadScreen_Frame.Visible = true
-- Resize to 10%
guiSettings_Module.ResizeBar(10, Inside_Bar);
-- Wait for the character to load and Resize to 40%
repeat wait() until localPlayer.Character ~= nil
guiSettings_Module.ResizeBar(40, Inside_Bar)
-- preload assets in the game
guiSettings_Module.preLoadAssets(assetsToPreload);
guiSettings_Module.ResizeBar(100, Inside_Bar);
-- Hide load screen
LoadScreen_Frame.TextLabel.Text = "LOADED!"
wait(1)
game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.All, true)
game.StarterGui["PLAY GUI"].Enabled = true
script.Parent:Destroy()
-- Required Modules
local guiSettings_Module =
require(game:WaitForChild("ReplicatedStorage"):WaitForChild("Modules"):FindFirstChild("Gui_Settings"));
-- My Variables.
local allPlayers = game:GetService("Players")
local localPlayer = game.Players.LocalPlayer
local playerGui = localPlayer.PlayerGui
local assetsToPreload = {workspace, playerGui}
local LoadScreen_Frame = script.Parent:FindFirstChild("Frame");
local Bar = LoadScreen_Frame:FindFirstChild("Bar");
local Inside_Bar = Bar:FindFirstChild("Inside_Bar");
-- Start loading
game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
LoadScreen_Frame.Visible = true
-- Resize to 10%
guiSettings_Module.ResizeBar(10, Inside_Bar);
-- Wait for the character to load and Resize to 40%
repeat wait() until localPlayer.Character ~= nil
guiSettings_Module.ResizeBar(40, Inside_Bar)
-- preload assets in the game
guiSettings_Module.preLoadAssets(assetsToPreload);
guiSettings_Module.ResizeBar(100, Inside_Bar);
-- Hide load screen
LoadScreen_Frame.TextLabel.Text = "LOADED!"
wait(1)
game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.All, true)
game.StarterGui["PLAY GUI"].Enabled = true
script.Parent:Destroy()
That’s quite weird. Here’s your code with some prints:
-- Required Modules
local guiSettings_Module =
require(game:WaitForChild("ReplicatedStorage"):WaitForChild("Modules"):FindFirstChild("Gui_Settings"));
-- My Variables.
local allPlayers = game:GetService("Players")
local localPlayer = game.Players.LocalPlayer
local playerGui = localPlayer.PlayerGui
local assetsToPreload = {workspace, playerGui}
local LoadScreen_Frame = script.Parent:FindFirstChild("Frame");
local Bar = LoadScreen_Frame:FindFirstChild("Bar");
local Inside_Bar = Bar:FindFirstChild("Inside_Bar");
-- Start loading
game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
LoadScreen_Frame.Visible = true
-- Resize to 10%
guiSettings_Module.ResizeBar(10, Inside_Bar);
-- Wait for the character to load and Resize to 40%
repeat wait() until localPlayer.Character ~= nil
guiSettings_Module.ResizeBar(40, Inside_Bar)
-- preload assets in the game
guiSettings_Module.preLoadAssets(assetsToPreload);
guiSettings_Module.ResizeBar(100, Inside_Bar);
-- Hide load screen
LoadScreen_Frame.TextLabel.Text = "LOADED!"
wait(1)
local PlayGui = localPlayer.PlayerGui:FindFirstChild("PLAY GUI")
print(PlayGui)
PlayGui.Enabled = true
game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.All, true)
script.Parent:Destroy()
-- Required Modules
local guiSettings_Module =
require(game:WaitForChild("ReplicatedStorage"):WaitForChild("Modules"):FindFirstChild("Gui_Settings"));
-- My Variables.
local allPlayers = game:GetService("Players")
local localPlayer = game.Players.LocalPlayer
local playerGui = localPlayer.PlayerGui
local assetsToPreload = {workspace, playerGui}
local LoadScreen_Frame = script.Parent:FindFirstChild("Frame");
local Bar = LoadScreen_Frame:FindFirstChild("Bar");
local Inside_Bar = Bar:FindFirstChild("Inside_Bar");
-- Start loading
game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
LoadScreen_Frame.Visible = true
-- Resize to 10%
guiSettings_Module.ResizeBar(10, Inside_Bar);
-- Wait for the character to load and Resize to 40%
repeat wait() until localPlayer.Character ~= nil
guiSettings_Module.ResizeBar(40, Inside_Bar)
-- preload assets in the game
guiSettings_Module.preLoadAssets(assetsToPreload);
guiSettings_Module.ResizeBar(100, Inside_Bar);
-- Hide load screen
LoadScreen_Frame.TextLabel.Text = "LOADED!"
wait(1)
local PlayGui = localPlayer.PlayerGui:FindFirstChild("PLAY GUI")
print(PlayGui)
PlayGui.Enabled = true
game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.All, true)
script.Parent:Destroy()
Correct me if I’m wrong however, if you use game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
it disables ALL gui components, which means if you try to make ANY gui object visible it won’t be visible in the first place.
Oh I just saw the problem! I had to remove the visibility and activate the visibility of playgui and it was solved, is it ok that way? enabled did not work for me
Ah, I see what you mean. Yes, you just had the “Main” frame invisible, so setting the visibility to true would work. The GUI was already enabled, so trying to set it to enabled had no effect.