Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Making ScreenGui not becoming unenabled?

How do I make my screen gui (Menuscreen) become unenabled and my other screen gui (Outfitscreen) enabled. I want it so when a person clicks on the screengui (Menuscreen) becomes unenabled and another gui becomes enabled.

local cam = workspace.CurrentCamera

local point = game.workspace["Camera For Outfit"]

script.Parent.MouseButton1Click:Connect(function()
	game.StarterGui["MenuScreen"].Enabled = false
	game.StarterGui["Outfitscreen"].Enabled = true
	cam.CameraType = "Scriptable"
	cam.CoordinateFrame = point.CFrame
	 
end)

1 answer

I recommend instead of having multiple ScreenGui's, you place all your interfaces (Frames) in one single 'Menu' Gui. It'll look nicer and that way you have the ability to use the Visible property and have Tweening available in your UIs.

You could separate them into a "Main Menu" ScreenGui and "Outfit" ScreenGui but you will need to extend your code and have a central Gui controller to do all that.

Some things I see in your code is that you're accessing the ScreenGui template inside of StarterGui. Think of StarterGui as a folder than copies it's children to a player's PlayerGui every time they spawn. You can't access StarterGui as it's something the client cannot see.

Instead, define the gui you're using and the Frames you want to make visible:

local cam = workspace.CurrentCamera

--You should wait for objects when in a local script.
local point = workspace:WaitForChild("Camera For OutFit")

local button = script.Parent --The button this local script is in

local mainGui = button.Parent --Assuming ScreenGui is the parent of button

button.MouseButton1Click:Connect(function()

	--You should check here if the one you're disabling isn't already disabled.
	--I think moving it from view is better. (Tween it out of screen)
	mainGui.MenuFrame.Visible = false
	mainGui.OutfitFrame.Visible = true

	--rest of your code
end)

2 comments

0

I inputed what you had written but its not working. Do you know any site that I can educate myself with more on guis?

0

Here's an article on working with Image/Text buttons. Close to what you need: https://www.robloxdev.com/articles/Creating-GUI-Buttons

This discussion is preserved as it was. New answers, comments, and votes are closed.