Create a script that cycles through scenes

I wish to create a script that would cycle from one scene to the next, I am making a fps shooter and would love for the maps to be on different levels and to have the ability to rotate between them. since this feature was added I have always wanted to use it. Thank you so much.

Here's a simple example.

-- Place in a client context and add your UI buttons for changing scene, and selecting the scene.

local next_button = script:GetCustomProperty("next"):WaitForObject()
local select_button = script:GetCustomProperty("select"):WaitForObject()

local local_player = Game.GetLocalPlayer()
local current_index = 1

-- Each entry would be the scene name

local scenes = {

	"a", "b", "c", "d"

}

-- Enable cursor to allow pressing the next and select button

UI.SetCursorVisible(true)
UI.SetCanCursorInteractWithUI(true)

local function change_scene()
	current_index = current_index + 1

	if(current_index > #scenes) then
		current_index = 1
	end

	return scenes[current_index]
end

next_button.clickedEvent:Connect(function()
	print("Next Scene:", change_scene())
end)

select_button.clickedEvent:Connect(function()
	print("Transfer to Scene:", scenes[current_index])

	-- Only works in published game

	local_player:TransferToScene(scenes[current_index])
end)