Issue - Can't re-enable another gui

Hi everyone, I’m having a problem.

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)

image

image

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()
1 Like

I tried and it won’t show :frowning:

just move

game.StarterGui["PLAY GUI"].Enabled = true

above

game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.All, true)
script.Parent:Destroy()

I already did it and as I showed in the image above it doesn’t work, is it a roblox studio bug or something? :scream:

may i see the new script you used?

Sure :pray:

-- 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()

You enabled it in the StarterGui, which is also a problem.

game.Players.LocalPlayer.PlayerGui["PLAY GUI"].Enabled = true

I didn’t realize that until I reread the line

I made the change and it still doesn’t work. :frowning:

try adding a wait(1) before the script destroys its parent. Tbh I don’t really know what’s happening.

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()

I made the change and it still doesn’t work. :frowning:

-- 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.

He reenabled it at the end, which you can tell by the backpack reappearing. Also, it doesn’t disable the GUIs themselves.

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 :frowning:

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.

1 Like

Thank you all very much for helping me! :smiley: