In a nutshell, I have a script that changes the value of a variable (for a GUI system based on a module) and it’s not working. Probably missing something simple but, I’m not sure.
Script:
local module = require (game.ReplicatedStorage.Modules.Teams)
local page = 1
local Button1 = script.Parent.Button1.TextButton
local Button2 = script.Parent.Button2.TextButton
local teamselected = script.Parent["Team Lable"]
local curentpagenumber = module[page]
local TotalPages = 16
while true do
wait(0.1)
teamselected.Text = 'Current Team Selected: '..curentpagenumber.name..''
end
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 module = require (game.ReplicatedStorage.Modules.Teams)
local page = 1
local Button1 = script.Parent.Button1.TextButton
local Button2 = script.Parent.Button2.TextButton
local teamselected = script.Parent["Team Lable"]
local curentpagenumber = module[page]
local TotalPages = 16
spawn(function()
while true do
wait(0.1)
teamselected.Text = 'Current Team Selected: '..curentpagenumber.name..''
end
end)
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)
Just that at the line where the click is detected, no matter what I put there it never runs (I tried a few other scripts, the script in that part now is more of a test.)