Hello! I am trying to create a “Find The” game on Roblox. The index (GUI) for the badges in the game cannot switch between the pages.
The code’s intent is to be able to go between different frames (pages of the index) with a variable called pagenumber that should change the page the player is on depending on what number it is.
I am not getting any error messages for this script.
Thank you for reading this!
Code here:
-- local player = game.Players.LocalPlayer
local screengui = player.PlayerGui.ScreenGui
local backbutton = screengui.BackButton
local forwardbutton = screengui.ForwardButton
local pagenumber = 1
local page1 = screengui.Index
local page2 = screengui.Index2
forwardbutton.MouseButton1Click:Connect(function()
pagenumber = pagenumber + 1
end)
backbutton.MouseButton1Click:Connect(function()
if pagenumber > 0 then
pagenumber = pagenumber - 1
end
end)
if pagenumber == 1 then
page1.Visible = true
page2.Visible = false
elseif pagenumber == 2 then
page1.Visible = false
page2.Visible = true
end