--Variables--
local GUI = script.Parent.Parent
local MainFrame = script.Parent.Parent.MainFrame
local ShopFrame = script.Parent.Parent.ShopFrame
local Button = script.Parent
--Debounce--
local Debounce = false
--Function--
Button.MouseButton1Click:Connect(function()
if not Debounce then
Debounce = true
MainFrame.Visible = true
ShopFrame.Visible = true
if MainFrame.Visible == true then -- suspected issue
local Notification = Instance.new("TextLabel")
Notification.Parent = GUI
Notification.Name = "Notification"
Notification.Size = Vector2.new(0, 190, 0, 50)
Notification.Position = Vector2.new(0.415, 0, 0.043, 0)
Notification.BackgroundTransparency = 1
Notification.Font = "Cartoon"
Notification.Text = "The shop is already open"
Notification.TextSize = 25
Notification.TextColor3 = Color3.fromRGB(255, 255, 255)
wait(1.5)
Notification:Destroy()
end
wait(2)
Debounce = false
end
end)
It would help to know what’s wrong with the if statement.
Edit: Besides the fact that I don’t know what’s actually wrong, I noticed you set MainFrame.Visible to true two lines above the second if statement. The if statement is redundant and not necessary. I would remove the if statement entirely.
Is there any errors in the output?
its checking if the frame is visible and if so it follows the function that its suppose to follow. There are no output errors and the the function won’t play. Nothing is being created.
If you’re setting the visible to true, then there’s no point of the if statement. Maybe try removing the if MainFrame.Visible == true then
function.
its checking if its visible. Not making it visible. The issue is the if function part.
You did set the MainFrame to visible. If you’re going to set it, then there’s no point in checking it.
Thats the shop frame. Thats not the main frame.
I don’t think it’s the if statement what I think is glitching is the
Notification.Size = Vector2.new(0, 190, 0, 50)
Notification.Position = Vector2.new(0.415, 0, 0.043, 0)
They do not use Vector2 Rather UDim2 is what they use.
Hope this helps!