Explanation
My gui is made to switch between 2 pages when someone clicks next/previous. This is just added on to my shop gui, which isn't relevant.
Problem
This works, but for some reason I need to click twice when switching between pages. This can cause confusion, and people may think it's broken.
Code [First is for the next button, and the second is for the previous button.]
npopen = false
script.Parent.MouseButton1Down:connect(function()
if npopen == false then
npopen = true
script.Parent.BackgroundColor3 = Color3.new(100/255, 100/255, 100/255)
script.Parent.Parent.Previous.BackgroundColor3 = Color3.new(0, 0, 0)
script.Parent.Parent.NextPage.Visible = true
elseif npopen == true then
npopen = false
print('already open')
end
end)
local popen = false
script.Parent.MouseButton1Down:connect(function()
if popen == false then
popen = true
script.Parent.BackgroundColor3 = Color3.new(100/255, 100/255, 100/255)
script.Parent.Parent.Next.BackgroundColor3 = Color3.new(0, 0, 0)
script.Parent.Parent.NextPage.Visible = false
elseif popen == true then
popen = false
print('already closed')
end
end)
