So it throws no errors. All of the frames are being referenced correctly. I am so confused and do not know how to fix it, I have been searching for examples and cannot find ANYTHING. Even ChatGPT couldnt make a working one.
local StarterGui = game:GetService("StarterGui")
local DonationGui = StarterGui:WaitForChild("GamepassesGUI").Box
local TutorialGui = StarterGui:WaitForChild("TutorialGUI").Box
local CashDropGui = StarterGui:WaitForChild("CashDropGui").MainFrame
local function checkGuiOpen(gui1, gui2, gui3)
return gui1.Visible or gui2.Visible or gui3.Visible
end
local function closeAllGuis(gui1, gui2, gui3)
gui1.Visible = false
gui2.Visible = false
gui3.Visible = false
end
script.Parent.MouseButton1Click:Connect(function()
if checkGuiOpen(DonationGui, TutorialGui, CashDropGui) then
print("Other GUIs are open")
closeAllGuis(DonationGui, TutorialGui, CashDropGui)
if script.Parent.Parent.Box.Visible then
script.Parent.Parent.Box.Visible = false
else
script.Parent.Parent.Box.Visible = true
end
else
if script.Parent.Parent.Box.Visible then
script.Parent.Parent.Box.Visible = false
else
script.Parent.Parent.Box.Visible = true
StarterGui.Currency.Frame.Visible = false
end
end
end)
I rewrote it alot. Also, it is a LocalScript
Why are you getting StarterGUI if this is in a localscript? If I understand correctly, this is all you should have to do...
local DonationGui = --insert gui location in here example: script.Parent.Parent.Parent.DonationGui--
local TutorialGui = --insert gui location in here example: script.Parent.Parent.Parent.DonationGui--
local CashDropGui = --insert gui location in here example: script.Parent.Parent.Parent.DonationGui--
local function closeAllGuis(gui1, gui2, gui3)
gui1.Visible = false
gui2.Visible = false
gui3.Visible = false
end
script.Parent.MouseButton1Click:Connect(function()
if DonationGui.Visible == true and TutorialGui.Visible == true and CashDropGui.Visible == true then then
print("Other GUIs are open")
closeAllGuis(DonationGui, TutorialGui, CashDropGui)
if script.Parent.Parent.Box.Visible == true then
script.Parent.Parent.Box.Visible = false
else
script.Parent.Parent.Box.Visible = true
end
else
if script.Parent.Parent.Box.Visible == true then
script.Parent.Parent.Box.Visible = false
else
script.Parent.Parent.Box.Visible = true
StarterGui.Currency.Frame.Visible = false
end
end
end)