pagenum = "" local pgnum = script.Parent.Parent.PGNUM.Value if pgnum == "2" then function onclicked() pagenum = 2-1 pgnum = 2 script.Parent.Parent.pg.Text = "Page "..pagenum.."" script.Parent.Parent.pg1.Visible = true script.Parent.Parent.pg2.Visible = false end end script.Parent.MouseButton1Down:connect(onclicked)
It's supposed to act like a click change page type thing. You click the right arrow, it changes pgnum to 2, then left arrow checks if the value of pgnum is 2. if it is then if you press the left arrow it will go back to page 1
but the value doesn't change, why?
pagenum = 0 local pgnum = script.Parent.Parent.PGNUM --This is setting the actual value of the value as a variable, not the instance itself. function onclicked() if pgnum.Value == "2" then --This should be inside the function. pagenum = "" ..2-1.. "" --Should be a string since you will concatenate it. pgnum.Value = 1 script.Parent.Parent.pg.Text = "Page "..pagenum.."" script.Parent.Parent.pg1.Visible = true script.Parent.Parent.pg2.Visible = false end end script.Parent.MouseButton1Down:connect(onclicked)