One GUI visible at a time

I want to make it so if one of the frames is opened then it makes the other icons/frames/buttons not visible so that they don’t overlap.
But the frames that are always visible are :
GamepassChangers
So if anyone knows where to place the script and make a script then I could use the help because I searched on YouTube and could find no tutorial for this.

2 Likes

Hey there are few possible ways you can do this.
One way is when a button pressed for a gui, it loop thru all the ScreenGuis and disable them.
For an example In open button,

local PlayerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
script.Parent.MouseButton1Click:Connect(function()
     for _, Object in PlayerGui:GetChildren() do
       if not Object:IsA("ScreenGui") then continue end
       Object:SetAttribute("State", Object.Enabled)
       Object.Enabled = Object:IsAncestorOf(script.Parent)
    end
end)

then in close button

local PlayerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
script.Parent.MouseButton1Click:Connect(function()
     for _, Object in PlayerGui:GetChildren() do
       if not Object:IsA("ScreenGui") then continue end
       Object.Enabled = Object:GetAttribute("State")
    end
end)

you can also use a centralized script and use client side bindable events too.
Hope this helps :slight_smile:

3 Likes

I will try it out! And I will tell you if it work.

And I am wondering how could I enable Blur and add some fov beacuse I don’t really know how to code :laughing:.

if u wait a sec i can get some code i found from studio

Yes thank you I have lots of time! After you send it here I will tell you if it works!

1 Like

local script in starter gui

repeat wait() until workspace.CurrentCamera
local Camera = workspace.CurrentCamera

script.ESCB.Parent = Camera
script.ESCC.Parent = Camera

local script in button ( abit messy but u can copy what u need :sweat_smile:)


script.Parent.MouseButton1Click:Connect(function()
	
	if script.Parent.SelectedButton.Value == false then
		print(script.Parent.Name)
		script.Parent.SelectedButton.Value = true
		-- function
		local Properties = {FieldOfView = 50}
		local Info = TweenInfo.new(0.25, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out) -- edit as you want
		local T = game:GetService("TweenService"):Create(game.Workspace.CurrentCamera, Info, Properties)
		T:Play()
	else
		script.Parent.SelectedButton.Value = false
		-- function
		local Properties = {FieldOfView = 70}
		local Info = TweenInfo.new(0.25, Enum.EasingStyle.Quint, Enum.EasingDirection.Out) -- edit as you want
		local T = game:GetService("TweenService"):Create(game.Workspace.CurrentCamera, Info, Properties)
		T:Play()

		TS:Create(Blur, TweenInfo.new(1), {Size = 0}, .25):Play()
		TS:Create(Color, TweenInfo.new(1), {Saturation = 0}, .25):Play()	end
end)
1 Like

I am not a scripter so I asked Ai because there was error with the ESCB and Ai gave me a working solution here is the script

local button = script.Parent – The button this script is inside

local function applyBlur()
local blur = game.Lighting:FindFirstChild(“BlurEffect”)
if not blur then
blur = Instance.new(“BlurEffect”)
blur.Size = 24 – Adjust blur intensity here
blur.Name = “BlurEffect”
blur.Parent = game.Lighting
end
end

button.MouseButton1Click:Connect(applyBlur)

and here is script to remove the blur

local button = script.Parent – The button this script is inside

local function removeBlur()
local blur = game.Lighting:FindFirstChild(“BlurEffect”)
if blur then
blur:Destroy()
end
end

button.MouseButton1Click:Connect(removeBlur)

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.