Need Help with a UI Script!

I created code that would make a shop and settings GUI appear to only the client that pressed the corresponding buttons by putting both frames into Replicated Storage and cloning them to the client. When the person re-presses the button the frame clone would do a tween animation and be destroyed. A small problem came up when I pressed both button before closing the first creating a stack of both frames. I tried to fix the issue by adding to my scripts code that would check if the other frame’s clone existed in the PlayerGUI and destroy it if it did before cloning the new one. But I didn’t know how to tell the other script to change it’s debounce value to false, making it where it just breaks the other script and I can only access one frame. Any ideas on how to fix the issue? Is there just a totally easier way to do it, or do I just have to use a remote event or something; Im confused.

For the Settings Script

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local player = game.Players.LocalPlayer
local debounce = false

script.Parent.MouseButton1Click:Connect(function()
	if debounce == false then
		if player.PlayerGui.Menu:FindFirstChild("ShopGUI") then
			local ShopGUI_Target = player.PlayerGui.Menu:WaitForChild("ShopGUI")
			ShopGUI_Target:TweenPosition(UDim2.new(-0.283, 0,0.187, 0), nil, Enum.EasingStyle.Linear, 0.10)
			wait(0.05) 
			ShopGUI_Target:Destroy()
			local SettingsGUI = game.ReplicatedStorage.SettingsGUI:Clone()
			SettingsGUI.Parent = player.PlayerGui.Menu
			SettingsGUI.Position = UDim2.new(-0.283, 0,0.187, 0)
			SettingsGUI:TweenPosition(UDim2.new(0,0,0.187,0), nil, Enum.EasingStyle.Linear, 0.10)
			debounce = true
		else
			local SettingsGUI = game.ReplicatedStorage.SettingsGUI:Clone()
			SettingsGUI.Parent = player.PlayerGui.Menu
			SettingsGUI.Position = UDim2.new(-0.283, 0,0.187, 0)
			SettingsGUI:TweenPosition(UDim2.new(0,0,0.187,0), nil, Enum.EasingStyle.Linear, 0.10)
			debounce = true
		end
	elseif debounce == true then
		local SettingsGUI_Clone = player.PlayerGui.Menu:WaitForChild("SettingsGUI")
		SettingsGUI_Clone:TweenPosition(UDim2.new(-0.283, 0,0.187, 0), nil, Enum.EasingStyle.Linear, 0.10)
		wait(0.05) 
		SettingsGUI_Clone:Destroy()
		debounce = false
	end
end)

For the Shop Script (Note: This one doesn’t have the code that checks if the other GUI exists because I knew it currently was broken)

local ReplicatedStorage = game.ReplicatedStorage
local player = game.Players.LocalPlayer
local debounce = false

script.Parent.MouseButton1Click:Connect(function()
	if debounce == false then
		local ShopGUI = game.ReplicatedStorage.ShopGUI:Clone()
		ShopGUI.Parent = player.PlayerGui.Menu
		ShopGUI.Position = UDim2.new(-0.283, 0,0.187, 0)
		ShopGUI:TweenPosition(UDim2.new(0,0,0.187,0), nil, Enum.EasingStyle.Linear, 0.10)
		debounce = true
	elseif debounce == true then
		local ShopGUI_Clone = player.PlayerGui.Menu:WaitForChild("ShopGUI")
		ShopGUI_Clone:TweenPosition(UDim2.new(-0.283, 0,0.187, 0), nil, Enum.EasingStyle.Linear, 0.10)
		wait(0.05) 
		ShopGUI_Clone:Destroy()
		debounce = false
	end
end)

What benefit is there to storing regularly used UI in replicated storage. To my knowledge its just a hassle to constantly clone it for no real benefit, I would personally forget about replicated storage for UI and just have everything in PlayerGui / Starter GUI

Thats what I thought in the beginning, but I don’t know how else to do it without making it visible to
everyone whenever it’s triggered to appear. Is there something else I can do to accomplish this without having to use Replicated Storage.