iv been trying to figure out why it fully executes the code when i press the Next button to cycle the menu but not when i press the previous button the menu still cycles correctly but for some reason the buttons stay large when it turns in backwards
it uses alot of variables so i cut it short(er) and just posted the code part in question i know its not the variables anyways cause everything works correctly in the forward direction
any help would be great cause iv been staring at the same script for so long my eyes are at the point of bleeding
also this menu is suppose to turn fully past the 360 point so it will go from the last selection all the way back to the first so people wont have to cycle backwards through everything to get to the beginning again after going to the end of the menu
local Counter = 1
local Debounce1 = false
local Debounce2 = false
function OnNext()
Counter = Counter + 1
Debounce1 = true
if Counter == 2 and Debounce1 == true then
Button1.Size = UDim2.new(0,60, 0,60)
Button2.Size = UDim2.new(0,100, 0,100)
Info1.Visible = false
Info2.Visible = true
Info3.Visible = false
Info4.Visible = false
Info5.Visible = false
Info6.Visible = false
Info7.Visible = false
Info8.Visible = false
Button1.Position = Loc8
Button2.Position = Loc1
Button3.Position = Loc2
Button4.Position = Loc3
Button5.Position = Loc4
Button6.Position = Loc5
Button7.Position = Loc6
Button8.Position = Loc7
Debounce1 = false
elseif Counter == 3 and Debounce1 == true then
Button2.Size = UDim2.new(0,60, 0,60)
Button3.Size = UDim2.new(0,100, 0,100)
Info1.Visible = false
Info2.Visible = false
Info3.Visible = true
Info4.Visible = false
Info5.Visible = false
Info6.Visible = false
Info7.Visible = false
Info8.Visible = false
Button1.Position = Loc7
Button2.Position = Loc8
Button3.Position = Loc1
Button4.Position = Loc2
Button5.Position = Loc3
Button6.Position = Loc4
Button7.Position = Loc5
Button8.Position = Loc6
Debounce1 = false
elseif Counter == 4 and Debounce1 == true then
Button3.Size = UDim2.new(0,60, 0,60)
Button4.Size = UDim2.new(0,100, 0,100)
Info1.Visible = false
Info2.Visible = false
Info3.Visible = false
Info4.Visible = true
Info5.Visible = false
Info6.Visible = false
Info7.Visible = false
Info8.Visible = false
Button1.Position = Loc6
Button2.Position = Loc7
Button3.Position = Loc8
Button4.Position = Loc1
Button5.Position = Loc2
Button6.Position = Loc3
Button7.Position = Loc4
Button8.Position = Loc5
Debounce1 = false
elseif Counter == 5 and Debounce1 == true then
Button4.Size = UDim2.new(0,60, 0,60)
Button5.Size = UDim2.new(0,100, 0,100)
Info1.Visible = false
Info2.Visible = false
Info3.Visible = false
Info4.Visible = false
Info5.Visible = true
Info6.Visible = false
Info7.Visible = false
Info8.Visible = false
Button1.Position = Loc5
Button2.Position = Loc6
Button3.Position = Loc7
Button4.Position = Loc8
Button5.Position = Loc1
Button6.Position = Loc2
Button7.Position = Loc3
Button8.Position = Loc4
Debounce1 = false
elseif Counter == 6 and Debounce1 == true then
Button5.Size = UDim2.new(0,60, 0,60)
Button6.Size = UDim2.new(0,100, 0,100)
Info1.Visible = false
Info2.Visible = false
Info3.Visible = false
Info4.Visible = false
Info5.Visible = false
Info6.Visible = true
Info7.Visible = false
Info8.Visible = false
Button1.Position = Loc4
Button2.Position = Loc5
Button3.Position = Loc6
Button4.Position = Loc7
Button5.Position = Loc8
Button6.Position = Loc1
Button7.Position = Loc2
Button8.Position = Loc3
Debounce1 = false
elseif Counter == 7 and Debounce1 == true then
Button6.Size = UDim2.new(0,60, 0,60)
Button7.Size = UDim2.new(0,100, 0,100)
Info1.Visible = false
Info2.Visible = false
Info3.Visible = false
Info4.Visible = false
Info5.Visible = false
Info6.Visible = false
Info7.Visible = true
Info8.Visible = false
Button1.Position = Loc3
Button2.Position = Loc4
Button3.Position = Loc5
Button4.Position = Loc6
Button5.Position = Loc7
Button6.Position = Loc8
Button7.Position = Loc1
Button8.Position = Loc2
Debounce1 = false
elseif Counter == 8 and Debounce1 == true then
Button7.Size = UDim2.new(0,60, 0,60)
Button8.Size = UDim2.new(0,100, 0,100)
Info1.Visible = false
Info2.Visible = false
Info3.Visible = false
Info4.Visible = false
Info5.Visible = false
Info6.Visible = false
Info7.Visible = false
Info8.Visible = true
Button1.Position = Loc2
Button2.Position = Loc3
Button3.Position = Loc4
Button4.Position = Loc5
Button5.Position = Loc6
Button6.Position = Loc7
Button7.Position = Loc8
Button8.Position = Loc1
Debounce1 = false
elseif Counter == 9 and Debounce1 == true then
Counter = 1
Button8.Size = UDim2.new(0,60, 0,60)
Button1.Size = UDim2.new(0,100, 0,100)
Info1.Visible = true
Info2.Visible = false
Info3.Visible = false
Info4.Visible = false
Info5.Visible = false
Info6.Visible = false
Info7.Visible = false
Info8.Visible = false
Button1.Position = Loc1
Button2.Position = Loc2
Button3.Position = Loc3
Button4.Position = Loc4
Button5.Position = Loc5
Button6.Position = Loc6
Button7.Position = Loc7
Button8.Position = Loc8
Debounce1 = false
end
end
function OnPrevious()
Counter = Counter - 1
Debounce2 = true
if Counter == 1 and Debounce2 == true then
Button1.Size = UDim2.new(0,60, 0,60)
Button2.Size = UDim2.new(0,100, 0,100)
Info1.Visible = false
Info2.Visible = true
Info3.Visible = false
Info4.Visible = false
Info5.Visible = false
Info6.Visible = false
Info7.Visible = false
Info8.Visible = false
Button1.Position = Loc8
Button2.Position = Loc1
Button3.Position = Loc2
Button4.Position = Loc3
Button5.Position = Loc4
Button6.Position = Loc5
Button7.Position = Loc6
Button8.Position = Loc7
Debounce2 = false
elseif Counter == 2 and Debounce2 == true then
Button2.Size = UDim2.new(0,60, 0,60)
Button3.Size = UDim2.new(0,100, 0,100)
Info1.Visible = false
Info2.Visible = false
Info3.Visible = true
Info4.Visible = false
Info5.Visible = false
Info6.Visible = false
Info7.Visible = false
Info8.Visible = false
Button1.Position = Loc7
Button2.Position = Loc8
Button3.Position = Loc1
Button4.Position = Loc2
Button5.Position = Loc3
Button6.Position = Loc4
Button7.Position = Loc5
Button8.Position = Loc6
Debounce2 = false
elseif Counter == 3 and Debounce2 == true then
Button3.Size = UDim2.new(0,60, 0,60)
Button4.Size = UDim2.new(0,100, 0,100)
Info1.Visible = false
Info2.Visible = false
Info3.Visible = false
Info4.Visible = true
Info5.Visible = false
Info6.Visible = false
Info7.Visible = false
Info8.Visible = false
Button1.Position = Loc6
Button2.Position = Loc7
Button3.Position = Loc8
Button4.Position = Loc1
Button5.Position = Loc2
Button6.Position = Loc3
Button7.Position = Loc4
Button8.Position = Loc5
Debounce2 = false
elseif Counter == 4 and Debounce2 == true then
Button4.Size = UDim2.new(0,60, 0,60)
Button5.Size = UDim2.new(0,100, 0,100)
Info1.Visible = false
Info2.Visible = false
Info3.Visible = false
Info4.Visible = false
Info5.Visible = true
Info6.Visible = false
Info7.Visible = false
Info8.Visible = false
Button1.Position = Loc5
Button2.Position = Loc6
Button3.Position = Loc7
Button4.Position = Loc8
Button5.Position = Loc1
Button6.Position = Loc2
Button7.Position = Loc3
Button8.Position = Loc4
Debounce2 = false
elseif Counter == 5 and Debounce2 == true then
Button5.Size = UDim2.new(0,60, 0,60)
Button6.Size = UDim2.new(0,100, 0,100)
Info1.Visible = false
Info2.Visible = false
Info3.Visible = false
Info4.Visible = false
Info5.Visible = false
Info6.Visible = true
Info7.Visible = false
Info8.Visible = false
Button1.Position = Loc4
Button2.Position = Loc5
Button3.Position = Loc6
Button4.Position = Loc7
Button5.Position = Loc8
Button6.Position = Loc1
Button7.Position = Loc2
Button8.Position = Loc3
Debounce2 = false
elseif Counter == 6 and Debounce2 == true then
Button6.Size = UDim2.new(0,60, 0,60)
Button7.Size = UDim2.new(0,100, 0,100)
Info1.Visible = false
Info2.Visible = false
Info3.Visible = false
Info4.Visible = false
Info5.Visible = false
Info6.Visible = false
Info7.Visible = true
Info8.Visible = false
Button1.Position = Loc3
Button2.Position = Loc4
Button3.Position = Loc5
Button4.Position = Loc6
Button5.Position = Loc7
Button6.Position = Loc8
Button7.Position = Loc1
Button8.Position = Loc2
Debounce2 = false
elseif Counter == 7 and Debounce2 == true then
Button7.Size = UDim2.new(0,60, 0,60)
Button8.Size = UDim2.new(0,100, 0,100)
Info1.Visible = false
Info2.Visible = false
Info3.Visible = false
Info4.Visible = false
Info5.Visible = false
Info6.Visible = false
Info7.Visible = false
Info8.Visible = true
Button1.Position = Loc2
Button2.Position = Loc3
Button3.Position = Loc4
Button4.Position = Loc5
Button5.Position = Loc6
Button6.Position = Loc7
Button7.Position = Loc8
Button8.Position = Loc1
Debounce2 = false
elseif Counter == 0 and Debounce2 == true then
Counter = 8
Button8.Size = UDim2.new(0,60, 0,60)
Button1.Size = UDim2.new(0,100, 0,100)
Info1.Visible = true
Info2.Visible = false
Info3.Visible = false
Info4.Visible = false
Info5.Visible = false
Info6.Visible = false
Info7.Visible = false
Info8.Visible = false
Button1.Position = Loc1
Button2.Position = Loc2
Button3.Position = Loc3
Button4.Position = Loc4
Button5.Position = Loc5
Button6.Position = Loc6
Button7.Position = Loc7
Button8.Position = Loc8
Debounce2 = false
end
end
NextButton.MouseButton1Click:connect(OnNext)
PreviousButton.MouseButton1Click:connect(OnPrevious)

7 comments
Not efficient. Most people won't read 341 lines of code
You could use a loop but I would not bother trying to figure out what ur variable names mean.
the variable names dont matter cause they aren't the things that are causing the issue so i didnt include them since the script was already long enough... and i already know its not the most efficient way to write it got any real advice you wanna give me
if you feel like reading through 170 lines of variables then i could always add them in for your reading pleasure otherwise you see my point for leaving them out now right ?
iv tried to figure it out using a loop thats what the script is an 8 stage loop that can go past its starting point in the same direction it starting moving and it can go backwards the same way it goes forwards the issue im having is when i go backwards for some reason the icons wont re-size back down to 60 from 100 on the other hand if i go forwards the icons work normally again
@hiimgoodpack Info is a frame that describes what button it lines up with does Info1 = Button1 then i just grabbed the position of each button so i could cycle them with eachothers positions honestly theres nothing to figure out the code block is 19 lines repasted 18 times with different sorting for each counter step. i dont mean to be rude but if you cant figure that out why bother posting here?
correction 19 lines re-pasted 16 times the next frame basically just adds 1 to the counter every time its clicked and subtracts 1 from the counter every time the previous button is clicked i tried creating the debounce as a 3 port switch but there was some conflict issues so i figured a seperate debounce for each button was better