--Main

NavigatorStringValue:GetPropertyChangedSignal("Value"):Connect(function()
	local new: string? = NavigatorStringValue.Value
	
	if new and tostring(new) and #new > 0 then
		table.insert(pendingNavigations, new)
		isPending = true
	end
end)

RunService.RenderStepped:Connect(function()
	if isPending then
		NavigatorFrame.Visible = true
		
		if time() > nextShowTime then
			local nextText: string = pendingNavigations[1]
			
			if nextText then
				nextShowTime = time() + math.max(#nextText / 20, 2)
				NavigatorText.Text = nextText

				table.remove(pendingNavigations, 1)
				
				script.NewMessage:Play()
			else
				isPending = false
			end
		end
	else
		NavigatorFrame.Visible = false
	end
end)
