local page = 0
local button = script.Parent
button.MouseButton1Down:Connect(function)
page = page+1
end)
if page == 1 then
script.Parent.Parent.Label.Text = "Page 1"
end
if page == 2 then
script.Parent.Parent.Label.Text = "Page 2"
end
if page == 3 then
script.Parent.Parent.Label.Text = "Page 3"
end
while true do
wait(0.1)
print(page)
end
So my issue is when I click next it changes the page number to 2 or whatever, but the text doesnt change…
This is because you are saying the if statements outside of the function, Try putting theif page == 1 then etc into the MouseButton1Down function!
local page = 0
local button = script.Parent
button.MouseButton1Down:Connect(function)
page = page+1
if page == 1 then
script.Parent.Parent.Label.Text = "Page 1"
end
if page == 2 then
script.Parent.Parent.Label.Text = "Page 2"
end
if page == 3 then
script.Parent.Parent.Label.Text = "Page 3"
end
end) --Notice how the if statements are in the function?
while true do
wait(0.1)
print(page)
end
local page = 0
local button = script.Parent
button.MouseButton1Down:Connect(function)
page = page+1
wait(0.2)
script.Parent.Parent.Label.Text = "Page "..tostring(page)
end)
while true do
wait(0.1)
print(page)
end
And about the wait loop, you should use RunService instead as it is more efficient. Because they are using print I am assuming they just have the wait loop for diagnosis.