So I have a script that changes pages by gathering data from a module script, and depending on what the value of page
depends which section of the module script is called. The problem is, when I change the value of page
in one function, the data from it doesn’t carry over into my other function for when another textbutton
is pressed.
Script:
local module = require (game.ReplicatedStorage.Modules.Teams)
local page = 1
local Button1 = script.Parent.Button1.TextButton
local Button2 = script.Parent.Button2.TextButton
local confirmteam = script.Parent.Play.TextButton
local teamselected = script.Parent["Team Lable"]
local TotalPages = 16
Button1.MouseButton1Click:Connect(function(player)
if page >=1 and page < TotalPages then
page = page + 1
print(page)
elseif page < 1 then
page = 1
else if page > TotalPages then
page = TotalPages
end
end
end)
local curentpagenumber = module[page]
confirmteam.MouseButton1Click:Connect(function(player)
print(curentpagenumber.name)
end)