I have a problem

I started making a horror game and added first lines of code but i got a error.
I have experience in Lua, but because I used Roblox. I think there is something different I need to do so it works...

local Ui = UITextBox.Text

while true do
Ui = "Intermission"
wait(15)
Ui = "Choose map"
wait(30)
Ui = "Game starting"
end

Error running Lua task: [C5CB27C369F76367] LobbyAndMap:1: attempt to index a nil value (global 'UITextBox')

So in Core that code would look more like this...

-- The TextBox would be a custom property on the script.
local UI = script:GetCustomProperty("TextBox"):WaitForObject()

local game_started = false

function Tick()
	if(game_started) then
		return
	end
		
	UI.text = "Intermission"
	Task.Wait(15)
	UI.text = "Choose Map"
	Task.Wait(30)
	UI.text = "Game Starting"
	game_started = true
end