Page number teller

-- the script
local GUI = script.Parent
local NextButton = GUI:WaitForChild("Next")
local BackButton = GUI:WaitForChild("Back")
local currentSlide = 0 -- Slide to start at

local Slides = {
	GUI.Slides.Slide1,
	GUI.Slides.Slide2,
	GUI.Slides.Slide3,
}

function changeSlide(mode)
	pcall(function()
		if mode == "-" then
			Slides[currentSlide + 1].Visible = false
		else
			Slides[currentSlide - 1].Visible = false
		end
	end)
	pcall(function() Slides[currentSlide].Visible = true end)
end

NextButton.MouseButton1Down:Connect(function()
	if currentSlide < #Slides then
		currentSlide = currentSlide + 1
		changeSlide("+")	
	end
end)

BackButton.MouseButton1Down:Connect(function()
	if currentSlide > 1 then
		currentSlide = currentSlide - 1
		changeSlide("-")
	end
end)

and this is what the GUI looks like. it has slides of memes in there but I don’t know how to show the players what slide they are on, currently, there are 3 slides so I want to show like 1/3 slides. As I said, youtube isn’t much help. I also want them to ski to a page they want to see. so let say the person was on slide 2 but when they leave they want to skip to page 2 so they can see. instead of auto clicking to the page they want.

local currentSlide = 1

for i = 1, #Slides, 1 do
    if Slides[i].Visible = true then
        currentSlide = i
    end
end

it will loop through all the slides finding the one that is visible
and then changing the page number

btw that script is for going back and forth. not showing what page they are on. I am gonna make a different GUI that shows what page that are on.

didn’t you ask how to see the page number?

basically i am making a gui to show what page they are at. the script i showed is the current thing i have for going back and forth. all i have to do is add a script to show the players what slide they are on.

is it going to be a separate script?
because I don’t see why you can’t make the script you showed the page teller script
btw I mean combining the scripts

i probably will make it a separate script.

although i dont even know how to make the script.

what is the point in that when you already have the currentSlide variable in the one you showed

it doesnt show a single thing about what page you are in.

wait cant i just make a text for each slide telling that page they are in?

yes you can do that
actually that is the easiest way

the only problem is that people can skip to that page so that i will figure out.

i probably won’t actually. :thinking: