What im trying to achieve is when i press the next or backwards button the map text changes based on the table and when it gets to the first or last value which is “House” it stops and you cant go further
local index = 1 -- a variable corresponding to the place in the table you're in
button.Activated:Connect(function()
index = math.clamp(index + 1, 1, 3)-- or "index - 1" if you want to go backward
Configurations.Map = Maps[index]
-- insert code here
end)
If you want to read on what math.clamp does, this may work.